Return the digits in reverse order

Thanks to David Hager for this original formula.
You can return the digits of a number (that has less than 15 digits) in reverse order by using an array formula.
This formula returns a text value (left aligned) to allow for any numbers that end with a zero.
This formula must be entered as an array formula using (Ctrl + Shift + Enter).


 A
187654321
2=RIGHT(SUM(VALUE(MID(A1&"1", ROW(INDIRECT("1:"&LEN(A1&"1"))), 1))*10^(ROW(INDIRECT("1:"&LEN(A1&"1")))-1)), LEN(A1)) = 12345678
3 
4101010
5=RIGHT(SUM(VALUE(MID(A4&"1", ROW(INDIRECT("1:"&LEN(A4&"1"))), 1))*10^(ROW(INDIRECT("1:"&LEN(A4&"1")))-1)), LEN(A4)) = 10101
6 
71234567890123450
8=RIGHT(SUM(VALUE(MID(A7&"1", ROW(INDIRECT("1:"&LEN(A7&"1"))), 1))*10^(ROW(INDIRECT("1:"&LEN(A7&"1")))-1)), LEN(A7)) = 0543210987654300
9 
101234567890123456789
11=RIGHT(SUMPRODUCT(VALUE(MID(A10&"1", ROW(INDIRECT("1:"&LEN(A10&"1"))), 1))*10^(ROW(INDIRECT("1:"&LEN(A10&"1")))-1)), LEN(A10)) = 9876543210987700000
12 
1311111000000000000000000000000000
14=RIGHT(SUM(VALUE(MID(A13&"1", ROW(INDIRECT("1:"&LEN(A13&"1"))), 1))*10^(ROW(INDIRECT("1:"&LEN(A13&"1")))-1)), LEN(A13)) = 1E+32

1 - Contains the number 87,654,321.
2 - Contains the array formula that reverses these digits.
4 - Contains the binary number 101010.
5 - Contains the array formula that reverses these digits. Notice that it has removed the zero from the front.
7 - Contains a number that has more than 15 digits.
8 - Contains the array formula that tries to reverse these digits. Notice that some rounding has taken place and that this is not exactly the same number.
If you want to reverse more than 15 digits then you will need to use the REVERSE User Defined Function.


User Defined Function

REVERSE - Returns the contents of a cell with all the characters reversed.


Related Formulas

Return the words in reverse order


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top