Remove characters before and after

sholleman

New Member
Joined
Mar 2, 2015
Messages
7
This is what i have: (The 0 and CA are on one line- 4 lines total)

000433821517 00114427
0 CA
000645000670 00234411 0 CA
000790810056 00229763 0 CA
000901000017 00068794 0 CA

<tbody>
</tbody>

This is what I want (keep second column, remove front zeros, add k to front)

<tbody>
</tbody>
k114427
k234411
k229763
k68794


<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
with one of these text strings in A1, use ="k"&INT(LEFT(RIGHT(A1,LEN(A1)-FIND(" ",A1)),FIND(" ",RIGHT(A1,LEN(A1)-FIND(" ",A1)))))
 
Upvote 0
with one of these text strings in A1, use ="k"&INT(LEFT(RIGHT(A1,LEN(A1)-FIND(" ",A1)),FIND(" ",RIGHT(A1,LEN(A1)-FIND(" ",A1)))))

The above didn't work. Here it is again:


000433821494 00114424 0 CA
000433821500 00114425 0 CA
000433821517 00114427 0 CA
000645000670 00234411 0 CA
 
Upvote 0
Looks like the format of the data is pretty consistent in length.

Try
="k"&MID(A1,16,6)
 
Upvote 0
Does this formula do what you want...

="k"&0+MID(A1,FIND(" ",A1),FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1))
 
Upvote 0
From the above, I got k 0011 but I want k114423.
If that's what you got from that formula, it looks like there are several spaces in there
000433821517______00114427

The _ represents a space, because the forum software will remove consecutive spaces.

Try
="k"&MID(TRIM(A1),16,6)
 
Upvote 0
I also notice that the 4th value you listed had a leading 0 in the resulting value that needs to be removed.

Try
="k"&MID(TRIM(A1),16,6)+0
 
Upvote 0

Forum statistics

Threads
1,216,212
Messages
6,129,531
Members
449,515
Latest member
lukaderanged

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