Prevent Excel Users from Entering Values with Data Validation
Question details
The user needs to restrict data entry in columns C and D of an Excel worksheet when the corresponding cell in column A is greater than zero, using a custom Data Validation rule.

- Product
- WPS Office Spreadsheets
- Device & OS
- not provided
- Scenario
- A spreadsheet owner wants to enforce a business rule so users cannot fill in certain columns when a related condition is met.
- Observed behavior
- Entries in columns C and D should be blocked automatically when the corresponding value in column A is greater than zero.
Open the workbook in WPS Office Spreadsheets and confirm the exact range in columns C and D that needs protection. Note the row number of the first selected cell, because the custom formula must match that row.
Use a Custom Data Validation Formula to Block Entries in Columns C and D When Column A Is Greater Than Zero
Use this solution when you need Excel or WPS Office Spreadsheets to reject values in columns C and D for any row where column A is greater than zero.
The custom formula is relative to the active cell. The column reference $A is absolute so every selected row compares against its own value in column A, while the row number adjusts automatically. When the formula returns FALSE, the entry is invalid and the error alert appears.
Open the workbook in WPS Office Spreadsheets, click the first cell in columns C or D, then drag to select the range such as C1:D100 where the restriction should apply.
Go to the Data tab on the ribbon and click Data Validation.
In the Allow list, select Custom. In the Formula box, enter =IF($A1>0,FALSE,TRUE). If your selection starts in a row other than 1, change $A1 to match that active cell row, for example $A2 for row 2.
Click the Error Alert tab, choose Stop as the style, enter a title such as "Entry not allowed", and type a custom message telling users why the entry is blocked.
Click OK, then test by entering a value in a restricted cell when column A is greater than 0 to confirm it is blocked, and again when column A is 0 or blank to confirm it is allowed.

Block Invalid Excel Entries with WPS Office Spreadsheets Data Validation
WPS Office Spreadsheets includes the same Data Validation feature, so you can apply a custom formula to columns C and D, add a Stop error alert, and prevent users from entering values when column A is greater than zero.
- 1. Open the workbook: Open the target workbook in WPS Office Spreadsheets.
- 2. Select columns C and D: Select the cells in columns C and D where the restriction is required, for example C1:D100.
- 3. Apply Custom Data Validation: Click the Data tab, open Data Validation, choose Custom, and enter =IF($A1>0,FALSE,TRUE).
- 4. Set a Stop error alert: On the Error Alert tab, choose Stop and add a clear message so users know why the entry is blocked.

Frequently Asked Questions
Can I apply this Data Validation rule to a range that starts in row 2 instead of row 1?
Yes. Select the range starting in row 2, open Data > Data Validation > Custom, and enter =IF($A2>0,FALSE,TRUE). Make sure the active cell is also in row 2 so the formula matches the selection start.
Why are users still able to type values in columns C or D?
Check that the Data Validation rule uses Custom, that the formula references column A with $A and the correct starting row, and that the Error Alert style is set to Stop. Also remove any previous validation rules or blank entries that may be bypassing the restriction.
Does this rule work in both WPS Office Spreadsheets and Microsoft Excel?
Yes. The Custom Data Validation formula and Error Alert settings work in both applications, and WPS Office Spreadsheets preserves the rule when you save in .xlsx format.
Can I apply the validation to entire columns C and D?
You can select columns C:D and use =IF($A1>0,FALSE,TRUE), but whole-column ranges can make the workbook slower. For better performance, use a specific range such as C1:D1000 when possible.
How do I remove this Data Validation rule later?
Select the same cells in columns C and D, go to Data > Data Validation, and click Clear All or Remove in the Data Validation dialog to delete the rule.




