Google-sheets – Dynamic Data Validation in Google Sheets

data validationformulasgoogle sheetsgoogle-sheets-arrayformula

I want to restrict a value in a cell based on another cell in the same row.

The value in A must not exceed what is in B. If the value in B is zero, any figure is allowed in A

A | B
---
4 | 9     – allowed

5 | 0     – allowed

6 | 5     – the value in A should not be allowed

How to set up data validation for this in column A.

I want all rows in Column A to have this validation rule.

Best Answer

Set the data validation for A1 as follow:

  • On Cell range set the cell range from Column A.
  • On the Criteria dropdown select: Custom formula is
  • On the formula input box add this formula: =OR(B1=0,A1<=B1)
  • On the On invalid data radio buttons selet Reject input

Dont' forget to click Save