Excel Data Validation

%3CLINGO-SUB%20id%3D%22lingo-sub-2644294%22%20slang%3D%22en-US%22%3EExcel%20Data%20Validation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2644294%22%20slang%3D%22en-US%22%3E%3CP%3EHi.%20I%20want%20to%20restrict%20someone%20putting%20an%20amount%20more%20than%202%20decimals%20into%20a%20cells.%3C%2FP%3E%3CP%3EThanks%20guys.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2644294%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2644398%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Data%20Validation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2644398%22%20slang%3D%22en-US%22%3EThanks%20Hans.%20I%20tried%20that%2C%20but%20I%20have%20plenty%20of%20cells.%20I%20want%20to%20change%20the%20properties%20of%20those%20Cells%2C%20so%20that%20you%20can't%20put%20in%20an%20amount%20more%20than%202%20decimals%20into%20those%20Cells.%20So%2C%20if%20you%20want%20to%20put%20in%20say%2023.245%20if%20must%20give%20you%20an%20error.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2644450%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Data%20Validation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2644450%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1127560%22%20target%3D%22_blank%22%3E%40FanieB%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20was%20the%20problem%20with%20the%20Data%20Validation%20rule%20that%20I%20proposed%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S0663.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F302978iA92146EE0B42B2B8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22S0663.png%22%20alt%3D%22S0663.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi. I want to restrict someone putting an amount more than 2 decimals into a cells.

Thanks guys.

5 Replies

@FanieB 

Using data validation:

Select the cells you want to apply the rule to. In the following, I will assume that A1 is the active cell in the selection.

On the Data tab of the ribbon, click Data Validation.

Select Custom from the Allow dropdown.

Enter the formula

 

=MOD(100*A1,1)=0

 

where A1 is the active cell.

Specify messages in the Input Message and Error Alert tabs, if you wish.

Click OK.

 

Alternatively, you could use the Worksheet_Change event procedure to round the input to 2 decimal places, but that would require users to allow macros.

Thanks Hans. I tried that, but I have plenty of cells. I want to change the properties of those Cells, so that you can't put in an amount more than 2 decimals into those Cells. So, if you want to put in say 23.245 if must give you an error.

@FanieB 

What was the problem with the Data Validation rule that I proposed?

 

S0663.png

Hans. These are the cells and the amounts. And like in Cell D7, it must not allowed me to put in an amount like 125.248 with 3 decimals. Than it must show an error.

@Hans Vogelaar 

@FanieB 

See the attached sample workbook. Try entering more than 2 decimals in D7, D8 or D9.