Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel Numbers: Million Round to Thousand; Hundreds to decimals; 0 show as -

Posted on 2010-11-22
17
Medium Priority
?
1,244 Views
Last Modified: 2012-05-10
I want to use the excel custom formating to show the following numbers

1,500,000  show as 1,500 note: no decimals
-1,500,000 show as (1,500) note: no decimals
150,000 show as 150 note: no decimals
-150,000 show as (150) note: no decimals
150  show as .15 note: two decimals
-150 shos as (.15) note: two decimals
0 show as "-" note: without quotation and no decimals

I would like to combine all these options under the custom formating of excel. Don't want to use formula like round function.
0
Comment
Question by:Pachecda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
17 Comments
 
LVL 23

Expert Comment

by:Michael Fowler
ID: 34191526
As far as I am aware this cannot be done with formatting. I think you will have to use a formula or even a macro.
0
 

Author Comment

by:Pachecda
ID: 34191631
I was hoping to use the operators like [<=> 1000], #,##, in the custom formating portion, but I guess is not doable. I use nvision to create financials and I really cannot use formula or even a macro since they populate automatically with little user intervention.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Pachecda
ID: 34191678
Hi Zopilote:

I look at your suggestion, but it does not exactly answers what I want in my description above.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34191876
Why not use this custom format?
#,##0.00, ;(#,##0.00,);0;
0
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 2000 total points
ID: 34191893
Sorry. I meant
#,##0.#, ;(#,##0.#,);-;
Didn't read your post too well.
0
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 2000 total points
ID: 34191908
Or this to dodge the leading 0s and allow up to three decimal places
#,###.###, ;(#,###.###,);-;
0
 

Author Comment

by:Pachecda
ID: 34192084
Hi Tommy;

I like your idea, but is there a way to pefect it even further. After pluggin #,##0.#, ;(#,##0.#,);-; as my custom format, I got:

Tommy             Optimal
864.3                     864
    2.                           2
    0.1                      0.1
If you can get my optimal to work, would be great. I only care about the decimal when is between 0 an 1000. Greater than that will round to thousand


0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34192136
What version of Excel do you have?
0
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 2000 total points
ID: 34192165
If you have 2007 you can use conditional formatting. Select the entire sheet and set a rule
formula =abs(A1)>=1000 then set the number format to #,###, ;(#,###,);-;
And the other case would just use the original format.
0
 

Author Comment

by:Pachecda
ID: 34192180
Sorry Tommy, I have version 2003.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34192208
If you have 2000/2003 you could do it in VBA, but I doubt you want to add macros just for that.
0
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 2000 total points
ID: 34192350
One other option would be
[>1000]#,###,;[<-1000]-#,###,;#,###.###,
This will display the numbers as you want, but will show negatives with - instead of () and 0 as . not -
This is as close as you can get in 2003 without macros.
0
 

Author Comment

by:Pachecda
ID: 34192977
Hi Tommy:

I was trying to move away from a macro, but I can have that macro run when the spreadsheet is open to see if we can get to the desire results. All of your options you presented were good and I like them, but they were not just the one I was looking for. However, thanks for the try. Do you think you can try VBA code.

Thanks.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34193018
This code would do it for the whole sheet
Dim r As Range

For Each r In Sheets("Sheet2").UsedRange
  If IsNumeric(r.Value) Then
    If Abs(r.Value) < 1000 Then
      r.NumberFormat = "#,###.###, ;(#,###.###,);-;"
    Else
      r.NumberFormat = "#,###, ;(#,###,);text;"
    End If
  Else
    r.NumberFormat = "General"
  End If
Next

Open in new window

0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34193027
Run that once and then add this code to the worksheet so it doesn't look at the whole thing every time.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range

For Each r In Target
  If IsNumeric(r.Value) Then
    If Abs(r.Value) < 1000 Then
      r.NumberFormat = "#,###.###, ;(#,###.###,);-;"
    Else
      r.NumberFormat = "#,###, ;(#,###,);text;"
    End If
  Else
    r.NumberFormat = "General"
  End If
Next
End Sub

Open in new window

0
 

Author Comment

by:Pachecda
ID: 34193067
Tommy you are the best, you have done. Thanks much
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question