Separate product number into individual cells.

KyleJackMorrison

Board Regular
Joined
Dec 3, 2013
Messages
107
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hello,

I have a product codes that is laid out like this:
1234-56-789-1234

Our product demand sheet requires the product numbers to be in it own cell and also without the "-".

Is there a formula or VBA code where i can convert the product number to:
A B C D E F G H I J K L M
1 2 3 4 5 6 7 8 9 1 2 3 4

Thanks in advance.
Kyle
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
With your original product code in A1 try in B1

=mid(substitute($A1,”-“,”’),column()-1,1)

if this gives desired result drag across to C1, D1 etc

i am not on a pc at the moment so cannot test
 
Upvote 0
Hi there. This does it if the structure is always the same:
Book4
ABCDEFGHIJKLM
11234-56-789-1234
21234567891234
Sheet4
Cell Formulas
RangeFormula
A2A2=MID($A1,1,1)
B2B2=MID($A1,2,1)
C2C2=MID($A1,3,1)
D2D2=MID($A1,4,1)
E2E2=MID($A1,6,1)
F2F2=MID($A1,7,1)
G2G2=MID($A1,9,1)
H2H2=MID($A1,10,1)
I2I2=MID($A1,11,1)
J2J2=MID($A1,13,1)
K2K2=MID($A1,14,1)
L2L2=MID($A1,15,1)
M2M2=MID($A1,16,1)
 
Upvote 0
Another solution if you have access to O365 dynamic array formulas:

Mapping_Doc.xlsx
ABCDEFGHIJKLMN
11234-56-789-12341234567891234
Sheet14
Cell Formulas
RangeFormula
B1:N1B1=TRANSPOSE(MID(SUBSTITUTE($A1,"-",""),ROW(INDIRECT("$1:$"&LEN(SUBSTITUTE($A1,"-","")))),1))
Dynamic array formulas.


Note if A1 is extended, then B1 will extend too as it is dynamic.
 
Last edited:
Upvote 0
I love jimrwards answer - better than mine - but it needs a tweak (a straight copy brings the wrong sort of double quote in, and the -1 isn't needed): try this in B1 and drag across:
=MID(SUBSTITUTE($A1,"-",""),COLUMN(),1)
 
Upvote 0
@jmacleary the -1 is required As column() in B will yield 2 so you need to offset by 1 to pick up first substring

i am working from an iPad hence the naff double quotes
 
Upvote 0
I love jimrwards answer - better than mine - but it needs a tweak (a straight copy brings the wrong sort of double quote in, and the -1 isn't needed): try this in B1 and drag across:
=MID(SUBSTITUTE($A1,"-",""),COLUMN(),1)

As @jimrward said he is starting in the 2nd column so needs to OFFSET by -1, otherwise use COLUMNS($B1:B1) and then you can drag across as an expanding reference.
 
Upvote 0
If you want your numbers to appear in say D1 onwards then -3 would be the offset basically you need to offset to the first character of your substituted string
 
Upvote 0
Alternatively, you could use
=MID(SUBSTITUTE($A1,"-",""),COLUMN(A1),1)
So that you don't have to worry about offsets
 
Upvote 0
Not quoting all - I was wrong in not reading Jim's solution as itscorrect if it starts in B1, however the OP wanted the result to start in A column, thats why I removed the -1. And of course fluff has the best answer.
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

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