Text to columns with formula

addepallibabu

New Member
Joined
May 25, 2016
Messages
26
Hi Everyone,

Can someone please help me out for text to column with formula.

Sachin Kumar Tendulkar *02-02-017*\15000
Mahendra Singh Dhoni \*03-02-2017*\40000
Virat Kohli *04-02-2017*\65000
Ajinkya Rahane Kumar *05-02-2017*\90000
Shikhar Dhawan *06-02-2017*\11500
Rohit Sharma *07-02-2017*\14000

Example:
SachinKumarTendulkar2/2/201715000

<tbody>
</tbody>

<colgroup><col></colgroup><tbody>
</tbody>
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi,

It's not necessary formula. Use Text to Columns first with " " (blank) as separator then use again Text to Columns in last column with this separator ""
 
Upvote 0
Since your data is not of consistent format (eg some names have 3 words and some 2 words, sometimes the date part is preceded by "*" and sometimes by "\*") it would have been preferable to see all the expected outcomes and layout.

However, see if these formulas, copied down, do what you expect.


Excel 2010 32 bit
ABCDEF
1Sachin Kumar Tendulkar *02-02-2017*\15000SachinKumarTendulkar02-02-201715000
2Mahendra Singh Dhoni \*03-02-2017*\40000MahendraSinghDhoni03-02-201740000
3Virat Kohli *04-02-2017*\65000ViratKohli04-02-201765000
4Ajinkya Rahane Kumar *05-02-2017*\90000AjinkyaRahaneKumar05-02-201790000
5Shikhar Dhawan *06-02-2017*\11500ShikharDhawan06-02-201711500
6Rohit Sharma *07-02-2017*\14000RohitSharma07-02-201714000
TTC
Cell Formulas
RangeFormula
B1=LEFT(A1,FIND(" ",A1)-1)
C1=IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=3,SUBSTITUTE(LEFT(A1,FIND(" ",A1,LEN(B1)+2)-1),B1&" ","",1),"")
D1=TRIM(MID(LEFT(A1,FIND(" ",A1,LEN(B1&C1)+3)-1),LEN(B1&C1)+2,LEN(A1)))
E1=TRIM(LEFT(RIGHT(SUBSTITUTE(A1,"*",REPT(" ",20)),40),20))
F1=RIGHT(SUBSTITUTE(A1,"\",REPT(" ",20)),20)+0
 
Last edited:
Upvote 0
it's a typo in this formula:
F1=RIGHT(SUBSTITUTE(A1,"",REPT(" ",20)),20)+0

<tbody>
</tbody>

should be:

F1=RIGHT(SUBSTITUTE(A1,"\",REPT(" ",20)),20)+0

<tbody>
</tbody>
 
Upvote 0
should be:

F1=RIGHT(SUBSTITUTE(A1,"\",REPT(" ",20)),20)+0

<tbody>
</tbody>
Well spotted! It wasn't actually a typo as you could see that the formula did produce the correct result in F1. Rather, it was the forum rendering of the code from the HTML maker, removing the "&bsol;" character.

In any case I have fixed it in my post now and thank you for pointing it out. :)
 
Upvote 0
is there any single formula that applicable?
Yes there is, but why replace 5 relatively short formulas that do the job quite efficiently with 5 very long ones that are much less efficient, just because they happen to be the same? :eek:
 
Upvote 0

Forum statistics

Threads
1,215,953
Messages
6,127,920
Members
449,411
Latest member
AppellatePerson

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