using space between number and text

baidya91

Board Regular
Joined
Jun 1, 2016
Messages
147
How can I rewrite the duration '
19years7months1days' in excel in the format '19 years 7 months 1 days' using space.

A1=
19years7months1days

B1= 19 years 7 months 1 days

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
UGLY, but
Code:
=MID(A1,1,2)&" "&MID(A1,3,5)&" "&MID(A1,8,1)&" "&MID(A1,9,6)&" "&MID(A1,15,1)&" "&MID(A1,16,4)
probably would be much simpler using Custom function !
 
Upvote 0
How can I rewrite the duration '
19years7months1days' in excel in the format '19 years 7 months 1 days' using space.

A1=
19years7months1days

B1= 19 years 7 months 1 days

<tbody>
</tbody>

<tbody>
</tbody>

Give this a try...
Code:
[table="width: 500"]
[tr]
	[td]=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"years"," years "),"months"," months "),"days"," days")[/td]
[/tr]
[/table]
 
Upvote 0
OMG.....obviously too much Xmas for me !!
nice one Rick....didn't even think of that..:oops:
A much smarter option....merry xmas and a happy NY to your Rick
 
Upvote 0

Forum statistics

Threads
1,214,782
Messages
6,121,532
Members
449,037
Latest member
tmmotairi

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