Philippa1975
New Member
- Joined
- Apr 29, 2016
- Messages
- 6
Hi,
because of the way data outputs from our work system, I need to extract a cost code string, from a long accounting string.
I've got one column in some data where the account strings are held.
they all start with the same 7 characters. The cost code is then from the 8th character, for 7 characters.
I've used =MID(string,8,7) to extract the string.
eg from 200.0075.5005 2 0.1 i've extracted 5.005 2
some cost codes have two numbers before the decimal place but are still 7 characters long
eg from 200.00714.0142 0.1 i've extracted 14.0142
In a second sheet I've got a table of values with details relating to the cost codes, set up like...
5005 "cost description" 5.005 2 RC
1414 "cost description" 14.0142 RC
...in columns A to D. These are system produced codes so I can't change anything.
In my sheet with the MID formula, I've got an INDEX MATCH set up to pull out the value in column A from the 2nd sheet - ie from 5.005 2 i want to return 5005:
=INDEX(column A in 2nd sheet,MATCH(sting extracted using MID formula,column C in 2nd sheet,0))
If the MID extraction has one number before the decimal point, the INDEX/MATCH works just fine. If it has 2, it doesn't.
I've done a LEN formula to make sure they are the same length on both sheets and I've checked that they are all formatted the same - ie are all General. I tried changing them to text, and to numbers but nothing works.
Can anyone help?
Thanks
because of the way data outputs from our work system, I need to extract a cost code string, from a long accounting string.
I've got one column in some data where the account strings are held.
they all start with the same 7 characters. The cost code is then from the 8th character, for 7 characters.
I've used =MID(string,8,7) to extract the string.
eg from 200.0075.5005 2 0.1 i've extracted 5.005 2
some cost codes have two numbers before the decimal place but are still 7 characters long
eg from 200.00714.0142 0.1 i've extracted 14.0142
In a second sheet I've got a table of values with details relating to the cost codes, set up like...
5005 "cost description" 5.005 2 RC
1414 "cost description" 14.0142 RC
...in columns A to D. These are system produced codes so I can't change anything.
In my sheet with the MID formula, I've got an INDEX MATCH set up to pull out the value in column A from the 2nd sheet - ie from 5.005 2 i want to return 5005:
=INDEX(column A in 2nd sheet,MATCH(sting extracted using MID formula,column C in 2nd sheet,0))
If the MID extraction has one number before the decimal point, the INDEX/MATCH works just fine. If it has 2, it doesn't.
I've done a LEN formula to make sure they are the same length on both sheets and I've checked that they are all formatted the same - ie are all General. I tried changing them to text, and to numbers but nothing works.
Can anyone help?
Thanks