简体   繁体   中英

Limit cell value input based on other cells selection

I have 10 rows where the same column in each row has a "Data Validation" applied to with a list of "Important" and "Not Important". I want the user to select the value for this list based column for at the maximum 5 rows. Thus if he/she has selected "Important" in 5 rows for this column, then he/she should not be able to select value for this column in any more rows.

How should this be achieved in excel.

If for range A1:A10, please try Data Validation with Settings of Allow: Custom, Formula:

=OR(AND(A1="Important",COUNTIF(A$1:A$10,"Important")<6),AND(A1="Not Important",COUNTIF(A$1:A$10,"Not Important")<6))  

in A1.

Try this:

Cell A1 value -> Important

Cell A2 value -> Not important

Your column with data validation -> B1:B10

Cell A3 formula -> =COUNTIF(B1:B10,"Important")

Set a data validation of list type on B1:B10 range having this formula as source -> =IF($A$3>=5, $A$2, $A$1:$A$2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM