Restrict decimal entries

Johnmus

Board Regular
Joined
Jun 18, 2011
Messages
138
Hi all,

I would like to restrict decimal entries in a spreadsheet to be whole or half. For example 5.5, 7.5, 9.5, 22.5 is ok, but 5.1, 7.7, 9.4 ,22.6 etc. is not.

Is that possible with formula? The ranges of cells would be D4:D81,F4:F81, I4:I81, L4:L81

Thank you!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi,

Your description says you wanted to "restrict decimal entries in a spreadsheet to be whole or half", so what you need is Data Validation.

Select "Data" tab, select your cells, D4:D81, click "Data Validation", select "Data Validation", choose "Custom", enter this formula:

=MROUND(D4,0.5)=D4

Click "OK"

Repeat for F4:F81, changing formula to =MROUND(F4,0.5)=F4
Repeat for your other ranges, changing formula to reference the first cell.

This will restrict any numeric entry that's Not whole or half.

If this isn't what you want, please explain in detail what you need.
 
Upvote 0
for a formula you can use MROUND()

Code:
data	rounded
1.11	1
1.22	1
1.33	1.5
1.44	1.5
1.55	1.5
1.66	1.5
1.77	2
1.88	2
1.99	2
2.1	2
formula in the rounded column is
Code:
=MROUND(A2,0.5)

not sure how to do it using cell format which is probably closer to what you want though
 
Upvote 0
Thank you for your quick response. Your suggestion to use MROUND works fine. Appreciate your help!

John
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

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