Number_Formatted

Format the number as
' <1000 = 1,2,55, 85, 989
' <1000000 = 1K, 455k, 989k
' <1000000000 = 1M, 32M, 989M
' <1000000000000 = 1B, 28B, 458B, 989B
' <1000000000000000 = 1T, ???????

Function Number_Formatted(Numbor)
' Format the number as
' <1000 = 1,2,55, 85, 989
' <1000000 = 1K, 455k, 989k
' <1000000000 = 1M, 32M, 989M
' <1000000000000 = 1B, 28B, 458B, 989B
' <1000000000000000 = 1T, ???????
Rett = Numbor
If Numbor < 1000 Then
ElseIf Numbor < 1000000 Then
Rett = Format(Numbor / 1000, "#k")
ElseIf Numbor < 1000000000 Then
Rett = Format(Number / 1000000, "#") & "M"
ElseIf Numbor < 1000000000000# Then
Rett = Format(Number / 1000000000, "#") & "G"
ElseIf Numbor < 1E+15 Then
Rett = Format(Number / 1000000000000#, "#") & "T"
End If
Number_Formatted = Rett
End Function

Numbor

Views 2507 Downloads 839


ANmarAmdeen
589
Math VBA
Revisions

v1.0

Tags