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.

[TABLE="width: 300"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Sachin Kumar Tendulkar *02-02-017*\15000[/TD]
[/TR]
[TR]
[TD]Mahendra Singh Dhoni \*03-02-2017*\40000[/TD]
[/TR]
[TR]
[TD]Virat Kohli *04-02-2017*\65000[/TD]
[/TR]
[TR]
[TD]Ajinkya Rahane Kumar *05-02-2017*\90000[/TD]
[/TR]
[TR]
[TD]Shikhar Dhawan *06-02-2017*\11500[/TD]
[/TR]
[TR]
[TD]Rohit Sharma *07-02-2017*\14000

Example: [TABLE="width: 442"]
<tbody>[TR]
[TD="class: xl65, width: 73"]Sachin[/TD]
[TD="class: xl65, width: 83"]Kumar[/TD]
[TD="class: xl65, width: 69"]Tendulkar[/TD]
[TD="class: xl66, width: 87"]2/2/2017[/TD]
[TD="class: xl65, width: 130"]15000[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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:
[TABLE="width: 100%"]
<tbody>[TR]
[TH="width: 10, bgcolor: #DAE7F5"]F1[/TH]
[TD="align: left"]=RIGHT(SUBSTITUTE(A1,"",REPT(" ",20)),20)+0[/TD]
[/TR]
</tbody>[/TABLE]

should be:

[TABLE="width: 100%"]
<tbody>[TR]
[TH="width: 10, bgcolor: #DAE7F5"]F1[/TH]
[TD="align: left"]=RIGHT(SUBSTITUTE(A1,"\",REPT(" ",20)),20)+0[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
should be:

[TABLE="width: 100%"]
<tbody>[TR]
[TH="width: 10, bgcolor: #DAE7F5"]F1[/TH]
[TD="align: left"]=RIGHT(SUBSTITUTE(A1,"\",REPT(" ",20)),20)+0[/TD]
[/TR]
</tbody>[/TABLE]
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,226,730
Messages
6,192,708
Members
453,748
Latest member
akhtarf3

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