# Data Validation based on IF Statement

#### FRED_SHEET

##### New Member
I am trying to create a data validation statement for data entry into Cell B1.

Cell A1 has a data validation statement limiting data to a Whole Number between 0 and 9,999,999.

I would like a data validation statement for Cell B1 based on an IF statement.

If A1 is greater than 0 (>0) B1 would be limited to a Whole Number between 0 and 11.

If A1 is blank or equal to zero B1 can be a Whole Number between 0 and 9,999,999.

I am not sure how to write data validation statement for B1 which would accomplish this result.

Any help would be greatly appreciated.

### Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

#### Alex Blakenburg

##### Well-known Member
I think this is what you are looking for
Min =IF(A1>0,0,0)
Max =IF(A1>0,11,9999999)

#### Alex Blakenburg

##### Well-known Member
No worries. Happy to help.

Replies
3
Views
72
Replies
6
Views
187
Replies
5
Views
179
Replies
1
Views
110
Replies
3
Views
105

1,130,119
Messages
5,640,218
Members
417,131
Latest member
Seanr19871

### 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.

### Which adblocker are you using?

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

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