Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Working with strings

On Wed, 30 Jul 2003 06:58:08 -0700, "MacroMan" wrote:

Column 1 Column 2
9908472 Concentration Account
007552642366 Pension Account
65654237 Retirement Account

Do I need to loop through each character of each string to
find the account or is there a better way?

Your help and example code would be most
appreciated...thanks in advance.


Well, you could do it with worksheet formulas:

Account Number (must be *array-entered*):

=MID(A1,MATCH(TRUE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),
FIND(" ",A1,MATCH(TRUE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0))
-MATCH(TRUE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0))

To array-enter, after pasting in the above, hold down <ctrl<shift while
hitting <enter. XL will place braces {...} around the formula.

Account Type:

=MID(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-
LEN(SUBSTITUTE(A1," ",""))-2))+1,FIND("(",A1)-
FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-2))-2)

Assumptions in the above:

1. Original data is in A1.
2. Numbers are first seen in the account number segment.
3. The format of the last three segments is as you present with account type;
<space; a word like Account; <space; parenthesis "("; no more spaces.





--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Working with Strings joe Excel Discussion (Misc queries) 2 March 8th 06 08:47 PM
How to find number of pairs of strings from list of strings? greg_overholt Excel Worksheet Functions 5 January 27th 06 10:42 PM
How can I count strings within strings Paul W Excel Worksheet Functions 4 June 14th 05 12:39 PM
Working with strings Andrew Lenczycki Excel Programming 0 July 30th 03 04:02 PM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"