Format numbers

Viking08

Board Regular
Joined
Feb 9, 2004
Messages
120
I have a spreadsheet and need to reformat the numbers. I want the number to be a "-" if it is 0. Normally this is not a problem becuase I can format it as accounting. But this is not helping this time. Is there a way I can do this through custom formating?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
the easy way to do this is Ctrl. F.

Then instead of find use replace. Replace all 0's with ="-".

Done
 
Upvote 0
Your values may be rounded.

0.00001 formatted to 0 decimals will show 0 and not -.
 
Upvote 0
If you need to use those cells in calculations, you might find this handy. I had dashes in my cells which represented 0. When I needed to use those cells in calculations in other places in my procedure I needed to treat the value of the cell "-" as 0. So I wrote this bit of code. So the variable x2 represents the value of the selected cell. If the value is "-", then I tell it to make x2 = 0. If it's not "-" then x2 is equal the number in that cell.

Dim Catchdash As String
FormatRange.Cells(i, Col2Num).Select
Catchdash = Selection.Value
If Catchdash = "-" Then
x2 = 0
Else
x2 = Selection.Value
End If

Who knows, you might find it handy. If not, oh well.

So if you nee
 
Upvote 0

Forum statistics

Threads
1,203,070
Messages
6,053,368
Members
444,658
Latest member
lhollingsworth

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