ExcelTip.com
Account Icon Account Icon Account Icon
ExcelTip.com

Go Back   Excel Help Forum > Limelight Media - ExcelTip.com Books > F1 Get the most out of Excel Formulas & Functions

Notices

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 08-22-2007, 08:33 PM
dvandaniker dvandaniker is offline
Registered User
 
Join Date: 22 Aug 2007
Posts: 3
dvandaniker is on a distinguished road
separate text and numbers

I need help creating a formula to separate the text from the numbers into 2 separate columns.

Examples are:
A1= Angel Romero 260.00
A2= Wieben Chiropractic Clinic 74.00
A3= R Ricardo Ramirez Dds 340.00

The 'Text to Column' function does not work because there is no fixed width and no deliminater. To add in a deliminater, like a "\", is an option but there are thousands of cells to do this to.

As you can see, using LEFT, RIGHT and MID functions become tricky since the deliminater would be a "space" but there are often several "spaces" in the string of characters.

Is there a way to SEARCH or FIND the first number and let that be the deliminater?

Thanks, Derek
Reply With Quote
  #2  
Old 08-22-2007, 09:03 PM
Ron Coderre's Avatar
Ron Coderre Ron Coderre is online now
Cheeky Forum Moderator
 
Join Date: 22 Mar 2005
Location: Massachusetts
Posts: 2,045
Ron Coderre will become famous soon enough Ron Coderre will become famous soon enough
Send a message via Yahoo to Ron Coderre
separate text and numbers

This might be the easiest approach....

With A1 containing text (ending with a space and numbers)

Try this
B1: =SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))
Copy that formula down as far as you need

If A1: Angel Romero 260.00
Then B1 returns: Angel Romero|260.00

Copy the Col_B formulas....<edit><paste special>...Check: Values...Click [OK]

That will hardcode the formula results
Last, <data><text-to-columns>...Delimited...Use | to break the text.

Is that something you can work with?
__________________
Regards,

Ron
Microsoft MVP (Excel)

Click here to see the Forum Rules
Reply With Quote
  #3  
Old 08-22-2007, 09:05 PM
Steel Monkey Steel Monkey is offline
Valued Forum Contributor
 
Join Date: 23 Nov 2005
Location: Sydney, Australia
Posts: 201
Steel Monkey is on a distinguished road
separate text and numbers

I would use text to columns, there is an option to treat consecutive delimiters as one. If you select this it should not matter if there is more then one space.....
Reply With Quote
  #4  
Old 08-23-2007, 04:42 PM
dvandaniker dvandaniker is offline
Registered User
 
Join Date: 22 Aug 2007
Posts: 3
dvandaniker is on a distinguished road
substitution works great

Ron,

thanks for your solution. it worked great. I don't quite understand the formula but it works.

Thanks a million,
Derek
Reply With Quote
  #5  
Old 08-23-2007, 04:46 PM
dvandaniker dvandaniker is offline
Registered User
 
Join Date: 22 Aug 2007
Posts: 3
dvandaniker is on a distinguished road
consecutive delimiters

Steel Monkey,

The consecutive delimiters option in "text to column" does not work for my problem because "consecutive" is taken to mean immediately consecutive, i.e. one character after another. The delimiters I could use are the spaces but these are at 2+ positions in the string that are not side by side.

anyways, thanks for your suggestion.

Derek
Reply With Quote
  #6  
Old 08-23-2007, 04:54 PM
Ron Coderre's Avatar
Ron Coderre Ron Coderre is online now
Cheeky Forum Moderator
 
Join Date: 22 Mar 2005
Location: Massachusetts
Posts: 2,045
Ron Coderre will become famous soon enough Ron Coderre will become famous soon enough
Send a message via Yahoo to Ron Coderre
separate text and numbers

Quote:
Originally Posted by dvandaniker
Ron,

thanks for your solution. it worked great. I don't quite understand the formula but it works.

Thanks a million,
Derek
Yes, it does look a little cryptic, doesn't it?

RE: =SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))

Basically, this part: LEN(A1)-LEN(SUBSTITUTE(A1," ",""))
takes the length of cell A1's displayed value and subtracts the length of the value without spaces. The difference is the number of spaces in that cell.

The wrap around SUBSTITUTE function replaces the last space (which is the count we calculated) with a pipe: |

So, if there were 3 spaces in A1 the formula partially resolves to this:
=SUBSTITUTE(A1," ","|",3)

I hope that helps.
__________________
Regards,

Ron
Microsoft MVP (Excel)

Click here to see the Forum Rules
Reply With Quote
Reply

Bookmarks

New topics in F1 Get the most out of Excel Formulas & Functions


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


All times are GMT -4. The time now is 10:40 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0