Convert random 3-digit number to it's smaller 3-digit boxed form

mft38Excel

New Member
Joined
Jan 22, 2022
Messages
8
Office Version
  1. 2016
  2. 2007
Platform
  1. Windows
I need to convert a 3-digit straight number to it's smaller 3-digit boxed number counterpart. There are 1,000 straight numbers in sequential order from 0 to 999. There are only 220 boxed numbers. Boxed numbers are unique in that their 3-digits are mostly in ascending sequential order, like 123 or 567. The exceptions are triplets, like 000 and 999 which have no order. The formula should match or find the boxed number that goes with the straight number.
 

Attachments

  • Convert-Random-Number-to-Boxed-Number.JPG
    Convert-Random-Number-to-Boxed-Number.JPG
    130.3 KB · Views: 18

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the MrExcel board!

From your description and image, the problem is still not clear to me.

There are 1,000 straight numbers in sequential order from 0 to 999.
The only sequential numbers that I can see in your image are all 4-digit numbers, not 3.

There are only 220 boxed numbers. Boxed numbers are unique in that their 3-digits are mostly in ascending sequential order, like 123 or 567. The exceptions are triplets, like 000 and 999 which have no order.
I don't understand the 220
3 digit numbers with digits in sequential ascending order by my calculations are only
012
123
234
345
456
567
678
789

Triplets are
000
111
222
333
444
555
666
777
888
999

That is 18 altogether in those two lists, not 220.

Clearly I have not understood.
So, can you try explaining again and perhaps give a sample of data and expected results with XL2BB?
 
Upvote 0
Hi, Please check below:

Straight numbers are in text format.

Book1
EF
1000000
2150015
3510015
4051015
5105015
6501015
7015015
8330033
9033033
10303033
11
Sheet1
Cell Formulas
RangeFormula
F1:F10F1=SMALL(VALUE(MID(E1,ROW(INDIRECT("1:" &LEN(E1))),1)),1)&SMALL(VALUE(MID(E1,ROW(INDIRECT("1:" &LEN(E1))),1)),2)&SMALL(VALUE(MID(E1,ROW(INDIRECT("1:" &LEN(E1))),1)),3)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Does this normally entered formula do what you want...

=MIN(B2:D2)&MEDIAN(B2:D2)&MAX(B2:D2)
 
Upvote 0
Solution
Welcome to the MrExcel board!

From your description and image, the problem is still not clear to me.


The only sequential numbers that I can see in your image are all 4-digit numbers, not 3.


I don't understand the 220
3 digit numbers with digits in sequential ascending order by my calculations are only
012
123
234
345
456
567
678
789

Triplets are
000
111
222
333
444
555
666
777
888
999

That is 18 altogether in those two lists, not 220.

Clearly I have not understood.
So, can you try explaining again and perhaps give a sample of data and expected results with XL2BB?
My apologies for insufficient description Peter_SSs. The 3-digit number [straight] that I needed to convert was in two formats within the table. First I had the 3-digits in separate fields, "strai_1", "strai_2," and "strai_3". Next I had the 3-digit number in one field, "straight". The "seq_no" was a row count only. The "Sample" table to the lower right showed the "straight" numbers that needed to be converted to the "boxed" numbers. The actual table I will use the solution in has 1,000 straight numbers in ascending sequential order.
The best solution for my purpose is given below.
Thank you,
 
Upvote 0
Does this normally entered formula do what you want...

=MIN(B2:D2)&MEDIAN(B2:D2)&MAX(B2:D2)
Greetings Rick,
Yes, this is the best solution for my purpose. I enter the formula in my "boxed" field, G2, and copy to G16. Formula takes the individual digits and arranges them in ascending order [horizontally]. Thank you, Rick
 
Upvote 0
Welcome to the MrExcel board!

From your description and image, the problem is still not clear to me.


The only sequential numbers that I can see in your image are all 4-digit numbers, not 3.


I don't understand the 220
3 digit numbers with digits in sequential ascending order by my calculations are only
012
123
234
345
456
567
678
789

Triplets are
000
111
222
333
444
555
666
777
888
999

That is 18 altogether in those two lists, not 220.

Clearly I have not understood.
So, can you try explaining again and perhaps give a sample of data and expected results with XL2BB?
Peter,
This formula from Rick below meets my need.

=MIN(B2:D2)&MEDIAN(B2:D2)&MAX(B2:D2)

I enter the formula in cells G2:G16 and it converts the straight number to a boxed number in ascending order [horizontally].

Thank you, Peter
 
Upvote 0
Hi, Please check below:

Straight numbers are in text format.

Book1
EF
1000000
2150015
3510015
4051015
5105015
6501015
7015015
8330033
9033033
10303033
11
Sheet1
Cell Formulas
RangeFormula
F1:F10F1=SMALL(VALUE(MID(E1,ROW(INDIRECT("1:" &LEN(E1))),1)),1)&SMALL(VALUE(MID(E1,ROW(INDIRECT("1:" &LEN(E1))),1)),2)&SMALL(VALUE(MID(E1,ROW(INDIRECT("1:" &LEN(E1))),1)),3)
Press CTRL+SHIFT+ENTER to enter array formulas.

Saurabhj,​

Thank you for the formula. You produced the results I was looking for. I noted that your formula started with the "Straight numbers are in text format". I entered the formula in cell F2 but I received the #VALUE! error instead of the result. I changed my integer straights [E2:E16] to Excel General format then to Text format but then received the #NUM! error. I took the options to Evaluate Formula and it shows problem with the first VALUE. I also used the keystroke, CTRL+SHIFT+ENTER.
 

Attachments

  • Convert-Random-Number-to-Boxed-Number_2.JPG
    Convert-Random-Number-to-Boxed-Number_2.JPG
    158.9 KB · Views: 4
Upvote 0
Another possible option (although Rick's is simpler)
Excel Formula:
=TEXT(SUM(10^{2,1,0}*AGGREGATE(15,6,MID(TEXT(E2,"000"),{1,2,3},1)+0,{1,2,3})),"000")
 
Last edited:
Upvote 0

Saurabhj,​

Thank you for the formula. You produced the results I was looking for. I noted that your formula started with the "Straight numbers are in text format". I entered the formula in cell F2 but I received the #VALUE! error instead of the result. I changed my integer straights [E2:E16] to Excel General format then to Text format but then received the #NUM! error. I took the options to Evaluate Formula and it shows problem with the first VALUE. I also used the keystroke, CTRL+SHIFT+ENTER.
Saurabhj,

I just installed XL2BB to capture my Excel table. Following are the results I received with your formula.

3-Digits-Straights-convert-to-Boxed.xlsx
ABCDEFGHIJKLMNO
1seq_nostrai_1strai_2strai_3straightboxed
20001410410#NUM!014
300020000000
4000301515
5000402424
6000503333
7000604242
8000705151015
9000806060
100009105105
110010150150
120011303303
130012321321
140013330330
150014501501
160015510510
17Sample
18straightboxedstraightconvert toboxed
19150=SMALL(VALUE(MID(E19,ROW(INDIRECT("1:" &LEN(E19))),1)),1)&SMALL(VALUE(MID(E19,ROW(INDIRECT("1:" &LEN(E19))),1)),2)&SMALL(VALUE(MID(E19,ROW(INDIRECT("1:" &LEN(E19))),1)),3)150015
20510510015
21051051015
22105105015
23501501015
24015015015
25330330033
26033033033
27303303033
28
29
30
31
32This works.
33seq_nostrai_1strai_2strai_3straightboxedResults
340001410410014014
350002000000000000
360003015015015
370004024024024
380005033033033
390006042042024
400007051051015015
3 straights to 3 boxed
Cell Formulas
RangeFormula
F2F2=SMALL(VALUE(MID(E2,ROW(INDIRECT("1:" &LEN(E2))),1)),1)&SMALL(VALUE(MID(E2,ROW(INDIRECT("1:" &LEN(E2))),1)),2)&SMALL(VALUE(MID(E2,ROW(INDIRECT("1:" &LEN(E2))),1)),3)
H34:H40H34=MIN(B34:D34)&MEDIAN(B34:D34)&MAX(B34:D34)
 
Upvote 0

Forum statistics

Threads
1,214,986
Messages
6,122,611
Members
449,090
Latest member
vivek chauhan

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