Forum Discussion
Data validation not functioning the same as a test formula
TheOldPuterMan Not sure what you try to achieve. When I break down the formula I understand the following.
AND(CA14="",CB14*100-INT(CB14*100)=0)
This will return TRUE if CA is empty and CB has up to two (i.e. 0,1 or 2) decimals.
AND(CA14=CB14,CB14*100-INT(CB14*100)=0)
This will return TRUE if CA is equal to CB and CB has up to two (i.e. 0,1 or 2) decimals.
Overall, the formula returns 1 if either of the two above are TRUE, otherwise it returns 0. Is this what you intend to achieve?
The issue that remains is that you want to use this in a formula within Data Validation (DV). I pasted the exact formula into a custom DV rule and it would allow everything when CA was empty. When CA was not empty it only allowed me to enter the exact same number in CB, but only if it did not have more than two decimals. This doesn't make any sense to me.
Now, you could enter the following formula in a custom DV rule. It will allow any number with up to two decimals, irrespective what's in CA.
=ISNUMBER(CB14)*(LEN(CB14)-IFERROR(FIND(".",CB14),LEN(CB14))<=2)
If your actual numbers are picked up by a formula, rather than by direct input in CB, you could wrap that formula in a ROUND function that rounds all numbers to 2 decimals). Then there is no need for DV doing the testing for you. But perhaps I'm missing the point completely here.