How to separate number and text from a string

hardik.chevron

New Member
Joined
Feb 24, 2011
Messages
4
Hi,
Let say I have few strings like
Houston 134.23.234.43
Austin 123.45.345.341
LasVegas 234.34.345.12
Port Arthur 123.23.232.1
St. louis 234.23.324.12

I want to separate city name and IP address in separte column. How can I do that? Which function should I use?

thanks,
Hardik
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Welcome to the Board!

Can we always assume we want to seperate them at the last space?
 
Upvote 0
Hi. Try this - note that it fails on St. Louis unless you change it to St Louis

Excel Workbook
ABC
1Houston 134.23.234.43Houston134.23.234.43
2Austin 123.45.345.341Austin123.45.345.341
3LasVegas 234.34.345.12LasVegas234.34.345.12
4Port Arthur 123.23.232.1Port Arthur123.23.232.1
5St. louis 234.23.324.12#VALUE!#VALUE!
Sheet4
 
Upvote 0
Based on my assumption above, try this:
Excel Workbook
ABC
14Houston 134.23.234.43Houston134.23.234.43
15Austin 123.45.345.341Austin123.45.345.341
16LasVegas 234.34.345.12LasVegas234.34.345.12
17Port Arthur 123.23.232.1Port Arthur123.23.232.1
18St. louis 234.23.324.12St. louis234.23.324.12
Sheet16
Cell Formulas
RangeFormula
B14=LEFT(A14,FIND("~",SUBSTITUTE(A14," ","~",LEN(A14)-LEN(SUBSTITUTE(A14," ",""))))-1)
C14=SUBSTITUTE(A14,B14&" ","")

Hope that helps.
 
Upvote 0
Try;

<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">Houston 134.23.234.43</td><td style=";">Houston</td><td style=";">134.23.234.43</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Austin 123.45.345.341</td><td style=";">Austin</td><td style=";">123.45.345.341</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">LasVegas 234.34.345.12</td><td style=";">LasVegas</td><td style=";">234.34.345.12</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">Port Arthur 123.23.232.1</td><td style=";">Port Arthur</td><td style=";">123.23.232.1</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">St. louis 234.23.324.12</td><td style=";">St. louis</td><td style=";">234.23.324.12</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet2</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">B1</th><td style="text-align:left">=TRIM(<font color="Blue">SUBSTITUTE(<font color="Red">A1,C1,""</font>)</font>)</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">C1</th><td style="text-align:left">=TRIM(<font color="Blue">RIGHT(<font color="Red">SUBSTITUTE(<font color="Green">A1," ",REPT(<font color="Purple">" ",LEN(<font color="Teal">A1</font>)</font>)</font>),LEN(<font color="Green">A1</font>)</font>)</font>)</td></tr></tbody></table></td></tr></table><br />
Copy down...
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top