in the following formula,
i need to search for each row in sheet one, all rows in sheet2, in columns B and D, and get from there the corresponding values:
=X2&"|" & IF(AND(Sheet1!E2=Sheet2!B2,Sheet1!C2=Sheet2!D2),Sheet2!Z2 & "|" & Sheet2!Y2,"")
=X2&"|" & IF(AND(Sheet1!E2=Sheet2!B:B,Sheet1!C2=Sheet2!D:D),Sheet2!Z#INDEX_of_lineWHICHMATCHESCRITERIA & "|" & Sheet2!Y#INDEX_of_lineWHICHMATCHESCRITERIA,"")
I have not figured how to properly use the INDEX
function to achieve this, combined with the above formula
i put the task in detail: I have an excel file. The task needed to be accomplished, is the following: for each row (actually for each id, stored in column A - which exists in sheet 1 ) that the following condition is true:
column E (which exists in sheet 1) = column B (which exists in sheet 2) AND column C (which exists in sheet 1) = column D (which exists in sheet 2),
i must insert data from column Z (which exists in sheet 2) and column Y (which exists in sheet 2) to column X (which exists in sheet 1).
If column X, has already data in it, all new inserted data must have | as a separator, and should be inserted in front of the existing value.
If no data exist in column Z, or Y, then nothing is inserted to column X.
I have tried without success, to use index match, but no luck, i think something more complicated is needed. How can i do this with an excel formula? How the below formula should be transformed, in order to get the row that fulfils the conditions? =X2&"|" & IF(AND(Sheet1!E2=Sheet2!B2,Sheet1!C2=Sheet2!D2),Sheet2!Z2 & "|" & Sheet2!Y2,"")
=X2&"|" & IF(AND(Sheet1!E2=Sheet2!B:B,Sheet1!C2=Sheet2!D:D),Sheet2!Z#lineWHICHMATCHESCRITERIA & "|" & Sheet2!Y#lineWHICHMATCHESCRITERIA,"")
=INDEX(Sheet2!$B:$B, MATCH(criteria, Sheet2!$B:$B, 0))
where criteria is the value you are trying to match. – Tim Wilkinson{=MATCH(Sheet1!$E2&Sheet1!$C2,Sheet2!$B:$B&Sheet2!$D:$D, 0)}
just remember to enter withCTRL+SHFT+ENTER
– Tim WilkinsonIF A = B
ANDIF A = B
, why check the same thing twice? You need to read through Boris' answer below, and then search for INDEX MATCH Multiple Values. – Tim Wilkinson