ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   500m, 500b, 500t, function? (https://www.excelbanter.com/excel-programming/347046-500m-500b-500t-function.html)

Tone[_2_]

500m, 500b, 500t, function?
 

Hi all,

sorry if this has already been posted before but I am looking for
user defined formula (if this doesn't already exist within Excel'
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 lik
it to round it to the nearest million and output 105m or also if I ca
get it to display 104.86m

Can someone please point me in the right direction?

Many thanks,
Ton

--
Ton
-----------------------------------------------------------------------
Tone's Profile: http://www.excelforum.com/member.php...fo&userid=2535
View this thread: http://www.excelforum.com/showthread.php?threadid=48978


Niek Otten

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" wrote in message
...

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




Tone[_3_]

500m, 500b, 500t, function?
 

Thank you!


--
Tone
------------------------------------------------------------------------
Tone's Profile: http://www.excelforum.com/member.php...o&userid=25356
View this thread: http://www.excelforum.com/showthread...hreadid=489788


Bob Phillips[_6_]

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" wrote in message
...
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" wrote in

message
...

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






Niek Otten

500m, 500b, 500t, function?
 
Yes, and that way you could still calculate with them!

--
Kind regards,

Niek Otten

"Bob Phillips" wrote in message
...
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" wrote in message
...
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" wrote in

message
...

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









All times are GMT +1. The time now is 11:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com