Getting a single cell to list its (4) digits in chronological order

jimblimm

Board Regular
Joined
May 11, 2012
Messages
219
in A1 have the number

4251

The cell b1 should display 1245

currently i have to split the number into 4 cells

c1=left(a1,1) d1=mid(a1,2,1) e1=mid(a1,3,1) f1=right(a1,1)

then i have to concatenate small to large.. its gotta be a simpler way
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,981
I think this will do what you want
=SUBSTITUTE(SUMPRODUCT(ISNUMBER(FIND(COLUMN(A1:J1),A1))*COLUMN(A1:J1)*(10^(9-COLUMN(A1:J1)))), "0", "")
 

Ingolf

Banned
Joined
Mar 20, 2011
Messages
809
I think this will do what you want
=SUBSTITUTE(SUMPRODUCT(ISNUMBER(FIND(COLUMN(A1:J1),A1))*COLUMN(A1:J1)*(10^(9-COLUMN(A1:J1)))), "0", "")

This formula works if the number has no "zero" inside and have not two or more identical number inside. See example below:
55103 --> 1351
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,784
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

Another way:

=TEXT(SUMPRODUCT(LARGE(--MID(E11,{1,2,3,4},1), {1,2,3,4}),{1,10,100,1000}), "0000")
 
Last edited:

jimblimm

Board Regular
Joined
May 11, 2012
Messages
219
the formula works on a number with all different digits but what if i had numbers like

0112
1111
1122

its dropping some of the digits
 

Ingolf

Banned
Joined
Mar 20, 2011
Messages
809
the formula works on a number with all different digits but what if i had numbers like

0112 This is not a number
1111 Here nothing to move because the number is in format you want
1122 Here nothing to move because the number is in format you want

its dropping some of the digits

shg formula is working for your example.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,553
Messages
5,636,989
Members
416,953
Latest member
broexc

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
Top