Ensuring a - symbol converts to a 0

Grover

New Member
Joined
Apr 23, 2019
Messages
13
Driving me insane right now. I have multiple users on the same spreadsheet. When a value is zero some enter 0 and some enter -
Is it possible to format the cell so if someone types - it automatically changes to a zero

Thanks
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi Grover

Have you considered just using a find and replace?
You could also set up a shortcut using a simple macro.
 
Upvote 0
I havent. Any guidance on how to do this would be fantastic. I do run a VBA that automatically capitalises in one column as the people using the spreadsheet seem incapable of a consistant format
 
Upvote 0
A very basic macro to replace - with 0 is

Sub DashtoZero()
'
' DashtoZero Macro
' Convert - to 0
'
' Keyboard Shortcut: Ctrl+y
'
Cells.Replace What:="-", Replacement:="0", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
End Sub

You can also find under Edit>Find>Replace.
 
Upvote 0
Hi. Got the macro to run but is there a way of this happening automatically rather than having to run the macro. Alos i only want it to apply to one sheet of the workbook. Thanks
 
Upvote 0
G'day Grover,

Depending on the nature of the data being entered, another method is to use Data Validation (found in the Data ribbon).

Select the column(s) you want to restrict the use of the "-" Select data Validation from the ribbon and again from the drop down, then select Whole number OR Decimal, then either select "greater than or equal to" and then put 0 in the Minimum box.

Select the Error Alert tab and enter a simple message such as "- not allowed, enter 0 instead".

Note- if you use negative numbers you will need to use the "between" option instead of "greater than or equal to 0" and apply limits that are outside of any possible range you would expect. This allows a "-" to be used with a number, but not by itself.

Cheers

shane
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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