Hi James, and welcome to the forum.
One method to extract the data as you've described would be to start by defining the entire combination as one field, then dividing that field up into the proper fields as necessary.
Let's call this combination field AcctCostDept, and define it as a character field.
Now we can define calculated fields in the Table window based on this field.
The formula for the Acct field is straightforward:
[font="courier"]Left(,5) /font[/quote]extracting the first 5 characters from our field.
Next, the CostCentre field:
substr(,7,3),"")) /font[/quote]If the field only has an account number, the CostCentre is "", an empty string. If the 7th position in the string is a dash, there's no Cost Centre code, so again, set it to an empty string. If none of those conditions are met we want the 3 characters in positions 7, 8 and 9.
Finally, the Dept field:
right(,3),"") /font[/quote]We look at the length of the field and compare that to the length of the field without the dashes. If the difference is 2, then two dashes exist in the string, and we can use the rightmost 3 characters. Otherwise 2 dashes do not appear in the string, so we set the field to an empty string, "".
Based on your sample, that should do it for you.
Monarch provides many functions that enable us to perform these sorts of manipulations to get exactly what we need. When time allows, have a good look at the available functions, and spend some time reading some of the online help. You'll quickly see how Monarch allows for this type of work.
Let us know if you have further questions on this.