Format Near Zero Numbers as Zero ($-)

Goodwin

New Member
Joined
Aug 11, 2010
Messages
13
I was hoping to create a custom number format that formatted all near zero numbers (say, any number greater than -0.001 and less than 0.001) to zero. I cannot use the round function because doing so creates other issues further along in the spreadsheet. Does anyone know if this is possible? I tried educating myself on adding conditions to custom number formats but to no avail...

Thanks in advance everyone.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I don't think you can do it with a number format because it either requires an ABS function or an AND, neither do I believe you can do with a number format.

Now it could be done with VBA, just need to know a few things. Are the numbers to be formatted typed in or the result of formulas and in what range?
 
Upvote 0
Does this do what you want?

[>=0.0009]General;[<=-0.0009]-General;0

Here's some numbers formatted that way with their underlying values in col B.

Excel Workbook
AB
90.0020.002
100.00170.0017
110.00140.0014
120.00110.0011
1300.0008
1400.0005
1500.0002
160-1E-04
170-0.0004
180-0.0007
19-0.001-0.001
20-0.0013-0.0013
21-0.0016-0.0016
Format near 0 to 0
 
Last edited:
Upvote 0
I don't think you can do it with a number format because it either requires an ABS function or an AND, neither do I believe you can do with a number format.

Now it could be done with VBA, just need to know a few things. Are the numbers to be formatted typed in or the result of formulas and in what range?

The numbers to be formatted are the result of formulas...I had already tried using ABS and AND in the custom number formatting and was hoping my inability to get it to work was a result of the way I was entering the custom number format. Thanks for confirming that I can't take that approach.
 
Upvote 0
Does this do what you want?

[>=0.0009]General;[<=-0.0009]-General;0

Here's some numbers formatted that way with their underlying values in col B.

Excel Workbook
AB
90.0020.002
100.00170.0017
110.00140.0014
120.00110.0011
1300.0008
1400.0005
1500.0002
160-1E-04
170-0.0004
180-0.0007
19-0.001-0.001
20-0.0013-0.0013
21-0.0016-0.0016
Format near 0 to 0

Oh, so close! I should have been more specific in my original post...I'm trying to use a modified Accounting format, so that my near zero numbers look like "$ - ". Your suggestion works great for positive numbers, but with negative numbers it keeps the negative sign in front of the $ sign. Any suggestions? Thanks a ton.
 
Upvote 0
Oh, so close! I should have been more specific in my original post...I'm trying to use a modified Accounting format, so that my near zero numbers look like "$ - ". Your suggestion works great for positive numbers, but with negative numbers it keeps the negative sign in front of the $ sign.
I don't think this can be achieved with Accounting format - at least I can't find a way.

Any suggestions?
Yes, use an extra column. Leave your current formula as is, but hide the column. Create a new column with a formula that sets your current formula values that are 'near' to zero, equal to zero. Format this column with the standard Accounting format. Continue to use your current formula results (in hidden column) for your further calculations.

Edit: The Accounting format does not sow very neatly in the Excel jeanie shot below, but I'm sure you get the drift.

Excel Workbook
ABCDE
1Data 1Data 2HiddenVisibleFurther calc based on hidden col
2532$ 2.00$ 1,000.00
354.50.5$ 0.50$ 850.00
454.99960.0004$ - $ 800.04
558-3$ (3.00)$ 500.00
655.0001-1E-04$ - $ 799.99
755.01-0.01$ (0.01)$ 799.00
Show near 0 as 0
 
Last edited:
Upvote 0
I don't think this can be achieved with Accounting format - at least I can't find a way.

Neither could I...oh well. Thanks for the suggestion of the hidden column. I was trying to avoid "unnecessary" columns for fear of confusing the ultimate user, but it looks like that's my only option. Thanks for all your help Peter.
 
Upvote 0

Forum statistics

Threads
1,215,471
Messages
6,125,000
Members
449,202
Latest member
Pertotal

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