Question

I would like to format big numbers in Excel in such a way that only the two most significant digits are displayed. Remaining digits would be padded with additional zero.

Example:

1234567 would be displayed as 1 200 000
and
1234 would be displayed as 1 200

Using the format # # " 000" would display 1234567 as 1 235 000 but this is not what I am looking for because it does not scale to one-digit-less numbers. Solutions like 1.2 M is not what I am looking for neither.

The same format should work for both examples. I don't want to round the number, but round the displayed value only (the format).

No correct solution

OTHER TIPS

Perhaps you could use conditional formatting as described here: http://www.wikihow.com/Apply-Conditional-Formatting-in-Excel

so if your number is over 100 and less than 1000 - # # " 00" over 1000 and less than 10000 - # # " 000"

etc etc

Edit - I know the tutorial is for some Mac version of excel, but Conditionl Formatting is still there in my Excel2010

Assuming your value is in A1, the following formula returns the correct result on both of your numbers

=ROUND(A1/POWER(10,LEN(A1)-2),0)*POWER(10,LEN(A1)-2)

In other words, get the number of digits...

LEN(A1)

Get 10^(Number of digits-2)

POWER(10,LEN(A1)-2)

Divide your number by that number

A1/POWER(10,LEN(A1)-2),0)

Round that number to get rid of the decimal

ROUND(A1/POWER(10,LEN(A1)-2),0)

And then multiply by that number to get your final result

=ROUND(A1/POWER(10,LEN(A1)-2),0)*POWER(10,LEN(A1)-2)

You can then use the TEXT formatting to get the format you want. Something like...

=TEXT(ROUND(A1/POWER(10,LEN(A1)-2),0)*POWER(10,LEN(A1)-2),"# ###")

Will probably meet your needs

EDIT: As mentioned in the comment, IF your original value is in a different cell, you can also use the following function for formatting

=CONCATENATE(LEFT(A1,2),REPT("0",LEN(A1)-2))

If the cells you wish to format in this fashion contain values rather than formulas, select the cells and run this tiny macro:

Sub PhancyPhormat()
    Dim r As Range, i As Long, le As Long
    Dim DQ As String
    DQ = Chr(34)
        For Each r In Selection
            s = CStr(r.Value)
            le = Len(s)
            For i = 3 To le
            Mid(s, i, 1) = "0"
        Next i
        phony = DQ & s & DQ & ";;;"
        r.NumberFormat = phony
    Next r
End Sub

You would need to re-run the macro if your change the values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top