I will assume that your values are currently in a column starting with
A1.
The first stage is to ensure that no spaces have crept in at the end
that we couldn't see. To do this, in column B use:
=ltrim(A1).
This will remove all double spaces and all spaces from the end.
Then in column C use Len to calculate the length of the string.
=len(B1)
Now we now the length, we know that the number is the last seven
digits, so we can use:
=MID(B1, 1, C1-7)
In column C, to extract the name.
And in column D
=mid(B1,C1 - 6, 7)
This will extract the number.
More elegantly (but with more potential for confusion):
The name can be found with:
=MID(TRIM(A1), 1, (LEN(TRIM(A1))-7))
And the number can be found with:
=MID(TRIM(A1), (LEN(TRIM(A1))-6), 7 )
Search strategy:
Excel help file, under text formulae.
Please feel free to request clarification, if you have trouble
implementing this.
jeremymiles-ga |
Clarification of Answer by
jeremymiles-ga
on
15 Feb 2003 03:07 PST
Sorry if that was confusing. Here is a simple version:
If the names are in column A, starting at row 1, in column B type:
=MID(TRIM(A1), 1, (LEN(TRIM(A1))-7))
And in column C type:
=MID(TRIM(A1), (LEN(TRIM(A1))-6), 7 )
If the names are in a different place, type the reference to the cell
at the top of the column instead of A1.
Then drag the contents down.
If that doesn't work, please try to explain more about where the cells
are in the sheet.
jeremymiles-ga
|