+ Reply to Thread
Results 1 to 5 of 5

500m, 500b, 500t, function?

  1. #1
    Registered User
    Join Date
    07-19-2005
    Posts
    6

    Red face 500m, 500b, 500t, function?

    Hi all,

    sorry if this has already been posted before but I am looking for a user defined formula (if this doesn't already exist within Excel's formulas) that will take a number and output it with a suffix of a 'm' for millions, 'b' for billions, 't' for trillions, etc.

    So if the functions took a number like this: 104,856,000 I would like it to round it to the nearest million and output 105m or also if I can get it to display 104.86m

    Can someone please point me in the right direction?

    Many thanks,
    Tony

  2. #2
    Niek Otten
    Guest

    Re: 500m, 500b, 500t, function?

    One way:

    Function NumChar(a As Double) As String
    Select Case a
    Case Is >= 1000000000000#
    NumChar = Format(a / 1000000000000#, "0.00") + "t"
    Case Is >= 1000000000
    NumChar = Format(a / 1000000000, "0.00") + "b"
    Case Is >= 1000000
    NumChar = Format(a / 1000000, "0.00") + "m"
    Case Else
    NumChar = Format(a, "0.00")
    End Select
    End Function


    --
    Kind regards,

    Niek Otten

    "Tone" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi all,
    >
    > sorry if this has already been posted before but I am looking for a
    > user defined formula (if this doesn't already exist within Excel's
    > formulas) that will take a number and output it with a suffix of a 'm'
    > for millions, 'b' for billions, 't' for trillions, etc.
    >
    > So if the functions took a number like this: 104,856,000 I would like
    > it to round it to the nearest million and output 105m or also if I can
    > get it to display 104.86m
    >
    > Can someone please point me in the right direction?
    >
    > Many thanks,
    > Tony
    >
    >
    > --
    > Tone
    > ------------------------------------------------------------------------
    > Tone's Profile:
    > http://www.excelforum.com/member.php...o&userid=25356
    > View this thread: http://www.excelforum.com/showthread...hreadid=489788
    >




  3. #3
    Registered User
    Join Date
    07-19-2005
    Posts
    6
    Thank you!

  4. #4
    Bob Phillips
    Guest

    Re: 500m, 500b, 500t, function?

    You could also use a custom format of

    [>1000000000]#,##0,,,"t";[>1000000]#,##0,,"m";General

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Niek Otten" <[email protected]> wrote in message
    news:%[email protected]...
    > One way:
    >
    > Function NumChar(a As Double) As String
    > Select Case a
    > Case Is >= 1000000000000#
    > NumChar = Format(a / 1000000000000#, "0.00") + "t"
    > Case Is >= 1000000000
    > NumChar = Format(a / 1000000000, "0.00") + "b"
    > Case Is >= 1000000
    > NumChar = Format(a / 1000000, "0.00") + "m"
    > Case Else
    > NumChar = Format(a, "0.00")
    > End Select
    > End Function
    >
    >
    > --
    > Kind regards,
    >
    > Niek Otten
    >
    > "Tone" <[email protected]> wrote in

    message
    > news:[email protected]...
    > >
    > > Hi all,
    > >
    > > sorry if this has already been posted before but I am looking for a
    > > user defined formula (if this doesn't already exist within Excel's
    > > formulas) that will take a number and output it with a suffix of a 'm'
    > > for millions, 'b' for billions, 't' for trillions, etc.
    > >
    > > So if the functions took a number like this: 104,856,000 I would like
    > > it to round it to the nearest million and output 105m or also if I can
    > > get it to display 104.86m
    > >
    > > Can someone please point me in the right direction?
    > >
    > > Many thanks,
    > > Tony
    > >
    > >
    > > --
    > > Tone
    > > ------------------------------------------------------------------------
    > > Tone's Profile:
    > > http://www.excelforum.com/member.php...o&userid=25356
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=489788
    > >

    >
    >




  5. #5
    Niek Otten
    Guest

    Re: 500m, 500b, 500t, function?

    Yes, and that way you could still calculate with them!

    --
    Kind regards,

    Niek Otten

    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    > You could also use a custom format of
    >
    > [>1000000000]#,##0,,,"t";[>1000000]#,##0,,"m";General
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Niek Otten" <[email protected]> wrote in message
    > news:%[email protected]...
    >> One way:
    >>
    >> Function NumChar(a As Double) As String
    >> Select Case a
    >> Case Is >= 1000000000000#
    >> NumChar = Format(a / 1000000000000#, "0.00") + "t"
    >> Case Is >= 1000000000
    >> NumChar = Format(a / 1000000000, "0.00") + "b"
    >> Case Is >= 1000000
    >> NumChar = Format(a / 1000000, "0.00") + "m"
    >> Case Else
    >> NumChar = Format(a, "0.00")
    >> End Select
    >> End Function
    >>
    >>
    >> --
    >> Kind regards,
    >>
    >> Niek Otten
    >>
    >> "Tone" <[email protected]> wrote in

    > message
    >> news:[email protected]...
    >> >
    >> > Hi all,
    >> >
    >> > sorry if this has already been posted before but I am looking for a
    >> > user defined formula (if this doesn't already exist within Excel's
    >> > formulas) that will take a number and output it with a suffix of a 'm'
    >> > for millions, 'b' for billions, 't' for trillions, etc.
    >> >
    >> > So if the functions took a number like this: 104,856,000 I would like
    >> > it to round it to the nearest million and output 105m or also if I can
    >> > get it to display 104.86m
    >> >
    >> > Can someone please point me in the right direction?
    >> >
    >> > Many thanks,
    >> > Tony
    >> >
    >> >
    >> > --
    >> > Tone
    >> > ------------------------------------------------------------------------
    >> > Tone's Profile:
    >> > http://www.excelforum.com/member.php...o&userid=25356
    >> > View this thread:

    > http://www.excelforum.com/showthread...hreadid=489788
    >> >

    >>
    >>

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1