简体   繁体   中英

Validation of value from two column of a sheet with insertion of value in another column of different sheet of an excel

I have a column in Sheet 1, say column A and whatever be the value going to be inserted in a particular cell for this column it should be validated from Column B and Column C of Sheet 2. If the value entered in the column A of sheet 1 matches with Column B and C of sheet 2, accept that value in the cell of sheet 1 else throw an error.

Sheet 2

Column B  Column C
234        657
456        378
678        451

Sheet 1 :

Column A

678 - this should be allowed but when i should insert
123 - this should throw an error as this value is not present in either column of Sheet 2.

I have tried using Range name to create the drop down list in another sheet based on the value source and then using Data Validation dialog and select List from the Allow drop down list but this is only working for one column value not for the value present in both the column B and C.

Anyone having any idea on how to frame this validation in formula

thanks in advance !

Perhaps try using COUNTIF in your Data Validation.

Assuming that your values are inserted into cells B1:C3, click on cell A1 > Data > Data Validation > Allow: Custom > Formula: =COUNTIF($B$1:$C$3,$A1)>0

After applying this validation, enter a value of 1 into cell A1 (it should return an error), while 657 should be accepted. Now you can copy & paste this validation into other cells in column A.

Hope it helps!

This issue has been solved using the formula COUNTIF(Sheet2!A:B,A2)>0, where Sheet 2 refers to the sheet from which the value has to be verfied and A:B is a range of two column in which value has been mentioned and A2 is the cell where you want to do the validation

thanks.

This is an answer to your second question:

I want to use Concatenate inside this formula.Say, I want to concatenate the value of two columns in the current sheet and then result should be compared with the concatenation of two column value in another sheet. Eg - The entered value in Column W and X in current sheet should be compared with the existing value in column Y and column Z of another sheet. I have tried using the formula COUNTIF(Sheet2!CONCAT($W$2,$X$2:$Y$2,$Z$2),A2)>0 and some different alteration but no luck.

Let's assume we have two sheets.

Sheet1 -> columns W&X -> this is where we will enter our data and create Data Validation.

Sheet2 -> columns Y&Z -> contains values against which we want to validate our input. In my example, I populated cells Y1:Z3 with the following values:

Sheet2中

Now, going back to Sheet1 , our goal is to be able to check a combination of column W & X in order to validate if an input should be accepted. For example:

工作表Sheet1

In order to achieve that, you need to click on Sheet1 cell X1, go to Data Validation > Custom > enter the following formula:

=SUMPRODUCT(--ISNUMBER(MATCH(W1&X1,Sheet2!$Y$1:$Y$3&Sheet2!$Z$1:$Z$3,0)))

The formula will combine what you're entering into cell X1 with a value of cell W1 and check if such combination already exists in Sheet2, cells Y1:Z3.

Hope it helps.

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