Issue with MOD-formula

zweiunddreissig

New Member
Joined
Jun 17, 2021
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Dear community,

I need your expert advice!

I am working on a sheet to calculate fees.

For the amount field, I have used the following formula in "Data Validation": =MOD(E23*100;2)=0
-> The rule should avoid users to enter more than two decimal places.

Now I have noticed that odd decimal places get an error message, however, even decimal places are ok.

Examples:
100.12 -> ok
100.13 ->nok

What is wrong with my formula? The cell should allow even and odd decimal places as long there are not more than 2 decimal places.

Many thanks for your help!!!

Best regards,
B.
 
After all, I was a Math major in college, not Computer Science.
Hey, I was a Math major in college too! Of course, I did not pursue math as an occupation... I practiced Civil Engineering for some 32.5 years before my retirement (which was quite a number of years ago now).
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Wow, what a simple change in the formula. Thanks a lot!!!!
To use the MOD function you should 1 not 2 like
Excel Formula:
=MOD(E23*100,1)=0

Just came across another issue with this new formula: =MOD(E23*100,1)=0
a) if I insert the amount 555.33 I receive an error message -> there are not more than 2 decimal places!?
b) if I insert the amount 666.33 it is fine


In the end, I would like to have an formula, that only shows an error message if the inserted amount has more than 2 decimal places:
i) 555.33 -> ok
ii)555.333 -> nok

I tried also this formula ( =(E23*100)-INT(E23*100)=0 ) but it seems the same issue appears here.

Any other solution???
 
Upvote 0
That's down to floating point errors, as pointed out by Toadstool.
How about
Excel Formula:
=MOD(ROUND(E23*100,5),1)
 
Upvote 0
Might this be the right formula?

=INT(E23*100)=(E23*100)

Since I'm not an expert, I need your help. Only with try an error I found out that suddenly there was an issue with the number 555.33.

Thanks a lot!!!
 
Upvote 0
Have you tried what Toadstool suggested?
 
Upvote 0
It should work (within the 15 digit precision challenge):
Excel Formula:
=RIGHT(TEXT(E23,"00000000.0000000"),5)="00000"
 
Upvote 0
Solution

Forum statistics

Threads
1,223,705
Messages
6,173,986
Members
452,541
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