Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You'll have to reverse the order of those ifs...
2,000,000,000,000 mod 1E12 = 0 so result = 2T 2,000,000,000,000 mod 1E9 = 0 so result = 2000G etc. Sam "BSc Chem Eng Rick" wrote: Function NumSuffix(MyNum as Long) as String Dim Result as String if MyNum Mod 1E12 = 0 then Result = CStr(Mynum/1E12) & " T" if MyNum Mod 1E9 = 0 then Result = CStr(Mynum/1E9) & " G" if MyNum Mod 1E6 = 0 then Result = CStr(Mynum/1E6) & " M" if MyNum Mod 1E3 = 0 then Result = CStr(Mynum/1E3) & " K" NumSuffix = Result End Function -- If this helps, please click "Yes" <<<<<<<<<<<< "Farooq Sheri" wrote: I need help with code to convert a number, for example 2000000, into 2 M or 2000000000 into 2 G etc. Thanks. Farooq |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
bar on chart isn't representing correctly | Charts and Charting in Excel | |||
Can I have words representing numbers in a formula? | Excel Discussion (Misc queries) | |||
how to convert whole numbers representing seconds to mm:ss | Excel Worksheet Functions | |||
Representing symbols in charts | Charts and Charting in Excel | |||
FORMULAS FOR ADDING LETTERS REPRESENTING NUMBERS | Excel Discussion (Misc queries) |