Reformat String to a new format using a custom formula

geomic788

New Member
Joined
Jun 27, 2013
Messages
12
Hello guys.
I need a custom formula to make some reformating.

The current format is as follows:

AE.PR.04.484S
or another example
AE.EM.23.320s7

I need those to be reformated in 4484D and 23320s7
There is a huge number of Product codes but the format is the same.So the general rules are:

Always remove the "AE.PR." or "AE.EM." part
Always remove ther dot after the first 2 numbers (04"." or 23"." )
If number starts with a zero (as in 04) remoze the zero
Keep the letter in the end

For better understanding the format can be explained as follows:

yy.xxx.ww

yy=04 or 23
xxx=484 or 320
ww=D or s7

Thank you in advance guys! :)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I'm assuming the first one is supposed to be 4484S

Try
=MID(SUBSTITUTE(A1,".",""),5,5)+0&MID(A1,13,2)
 
Upvote 0
If the number of dot-delimited fields can vary, or if the number of characters in those dot-delimited fields can vary, then you might need something like this...

=1*TRIM(LEFT(RIGHT(SUBSTITUTE("."&A1,".",REPT(" ",99)),198),99))&TRIM(RIGHT(SUBSTITUTE(A1,".",REPT(" ",99)),99))
 
Upvote 0
Thank you very much for your replies and im really sorry for the delay but i just saw it.I need to implement this in VBA code in order to make it automated.
So what i need to do is replace Column A that includes the codes in format AE.PR.02.004S and reformat it to 2004S with the function
=MID(A1,7,2)+0&MID(A1,10,255)

I need to create a subroutine that will do it in my main macro.

Could someone please provide the code ?
thank you all!!!
 
Upvote 0
Can't you use the formula then Copy and Paste Special Values?

Well a new excel project will be created each time i export my sales from my sales program so i created an excel project that copies the data from the draft export.Its like a host excel used to calculate.Since im gonna be using this like 20 times a day i would have to copy and paste the function every time.This is why i need it within the code so it formats in the right way by it self.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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