JugglerJAF
Active Member
- Joined
- Feb 17, 2002
- Messages
- 297
- Office Version
- 365
- Platform
- Windows
I have a data extract from an accounting system in which operators record 10 character serial numbers along with other bits of information in a free format text field.
What I need to do is to extract from that free format text field any text strings which are 10 characters in length.
Example 1:
LaserJet X1234Y Printer ABC1D23456 Z1234Y
Example 2:
GH567T5 3.0GHz 1P SCSI EU Server Product: 123498765 ABC12345DE
Example 3::
AB789 G3 X2.8GHz Server ProductID: 123456987 A1BCDEF23G ABCDEF234G
The required output for example 1 would be ABC1D23456
The required output for example 2 would be ABC12345DE
The required output for example 3 would be A1BCDEF23G as well as ABCDEF234G (either in separate columns or delimited by a character such as underscore in a single column)
Not all cells will contain a 10 digit serial number (which is expected, and either N/A or blank should be returned in these instances), but some cells will contain multiple serial numbers (up to 50 or possibly even more).
As you can see, there is absolutely no consistency in input (the bane of my life!). The serial number could be the first 10 characters, the last 10 characters (unlikely, but possible) or fall somewhere in the middle of the text string (in 95% of cases).
Even the serial numbers themselves are not consistent in their pattern of letters/numbers as they cover many different product types and descriptions. Most are a mixture of letters and numbers, some are all numeric and some are all alpha characters. When there are multiple serial numbers in a single cell they could be separated by commas, semi colons, spaces, forward or backward slashes - anything at all really.
I can't think of any way of extracting all the 10 character codes from within the text field either by formula or macro, but before I go back to my Boss and say that I can't do it (other than manually going through thousands of records each month), I thought I'd run the problem past the good folks of MrExcel to see if they had any suggestions.
Over to you...
What I need to do is to extract from that free format text field any text strings which are 10 characters in length.
Example 1:
LaserJet X1234Y Printer ABC1D23456 Z1234Y
Example 2:
GH567T5 3.0GHz 1P SCSI EU Server Product: 123498765 ABC12345DE
Example 3::
AB789 G3 X2.8GHz Server ProductID: 123456987 A1BCDEF23G ABCDEF234G
The required output for example 1 would be ABC1D23456
The required output for example 2 would be ABC12345DE
The required output for example 3 would be A1BCDEF23G as well as ABCDEF234G (either in separate columns or delimited by a character such as underscore in a single column)
Not all cells will contain a 10 digit serial number (which is expected, and either N/A or blank should be returned in these instances), but some cells will contain multiple serial numbers (up to 50 or possibly even more).
As you can see, there is absolutely no consistency in input (the bane of my life!). The serial number could be the first 10 characters, the last 10 characters (unlikely, but possible) or fall somewhere in the middle of the text string (in 95% of cases).
Even the serial numbers themselves are not consistent in their pattern of letters/numbers as they cover many different product types and descriptions. Most are a mixture of letters and numbers, some are all numeric and some are all alpha characters. When there are multiple serial numbers in a single cell they could be separated by commas, semi colons, spaces, forward or backward slashes - anything at all really.
I can't think of any way of extracting all the 10 character codes from within the text field either by formula or macro, but before I go back to my Boss and say that I can't do it (other than manually going through thousands of records each month), I thought I'd run the problem past the good folks of MrExcel to see if they had any suggestions.
Over to you...