to bring abbreviation B for billion and T for trillion

abdulncr

New Member
Joined
Aug 14, 2012
Messages
27
Hi friends,

I have value in trillion and million in a column and make it to the chart. the follow code pasted in the format cell custom- working fine for million and billion. Please help me how do i get it work for trillion too.
[>999999999.999]#.0,,, _-"B";[>999999.999]#.0,, "M";#,##0 _M

Regards
Abdul
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi,

Just add : #,,,," T"

HTH

HI,

Thanks for the answer, i added as you told. now become my custom format as below. still not working. could you please look into
[>999999999.999]#.0,,, _-"B";[>999999.999]#.0,, "M";##,#0 _M#,,,," T"

Regards
Abdul
 
Upvote 0
I'm assuming that it's because you have the Trillion at the end and therefore anything over 999999999.999 is coming up as B?

Do you need to put

[>999999999999.999]#.0,,, _-"T";

at the beginning?
 
Upvote 0
I'm assuming that it's because you have the Trillion at the end and therefore anything over 999999999.999 is coming up as B?

Do you need to put

[>999999999999.999]#.0,,, _-"T";

at the beginning?

Hi,
Thank u so much for the update. but when i add first i am getting message " microsoft excel cant use number format you typed". when i make only two condition for the T and B it is working fine. so am i right in assuming more than two condition is not accepting in the format. is there any way to accept more than two condition.
Regards
Abdul
 
Upvote 0
Sorry, you can't have more than 3 conditions.
But you can "fake" it by using VB event code...
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
  If Not Intersect(Target, Range("C:C")) Is Nothing Then
    If Target.Value < 1000000 Then
      Target.NumberFormat = "#,##0 _M"
    ElseIf Target.Value < 1000000000 Then
      Target.NumberFormat = "#.0,, ""M"""
    ElseIf Target.Value < 1000000000000# Then
      Target.NumberFormat = "#.0,,, _-""B"""
    Else
      Target.NumberFormat = "#.0,,,, _-""T"""
    End If
  End If
End Sub
NOTE: The above code is set to monitor Column C... change what I have highlighted in red to the letter designation for the actual column range you want to monitor.

HOW TO INSTALL Event Code
------------------------------------
If you are new to event code procedures, they are easy to install. To install it, right-click the name tab at the bottom of the worksheet that is to have the functionality to be provided by the event code and select "View Code" from the popup menu that appears. This will open up the code window for that worksheet. Copy/Paste the event code into that code window. That's it... the code will now operate automatically when its particular event procedure is raised by an action you take on the worksheet itself.
 
Upvote 0
But you can "fake" it by using VB event code...
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
  If Not Intersect(Target, Range("C:C")) Is Nothing Then
    If Target.Value < 1000000 Then
      Target.NumberFormat = "#,##0 _M"
    ElseIf Target.Value < 1000000000 Then
      Target.NumberFormat = "#.0,, ""M"""
    ElseIf Target.Value < 1000000000000# Then
      Target.NumberFormat = "#.0,,, _-""B"""
    Else
      Target.NumberFormat = "#.0,,,, _-""T"""
    End If
  End If
End Sub
NOTE: The above code is set to monitor Column C... change what I have highlighted in red to the letter designation for the actual column range you want to monitor.

HOW TO INSTALL Event Code
------------------------------------
If you are new to event code procedures, they are easy to install. To install it, right-click the name tab at the bottom of the worksheet that is to have the functionality to be provided by the event code and select "View Code" from the popup menu that appears. This will open up the code window for that worksheet. Copy/Paste the event code into that code window. That's it... the code will now operate automatically when its particular event procedure is raised by an action you take on the worksheet itself.

it is working fine. thank you so much for your help.
 
Upvote 0

Forum statistics

Threads
1,224,883
Messages
6,181,551
Members
453,052
Latest member
ezzat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top