简体   繁体   中英

Excel - Lookup and Match Values with multiple conditions

Currently have the following excel table

在此处输入图片说明

I would like to do the following

I want to write a IF statement or something else which would do this:

if (the value in service 4 for company 1 is 1, and the value in service 1 for company 1 is also 1, then copy the value 1 to a new column)

how can one do this in excel ?

If the matching does not exist then copy 0 or nothing

How about:

=IF(AND(B2=1,E2=1)=TRUE,1,0)

as based on : 在此处输入图片说明

Or you could use:

=IF(SUM(B2,E2)=2,1,0)

which achieves the same thing.

Assuming you put the company name that you want to check in G1 you could use the following

=--AND(VLOOKUP(G1,$A$2:$E$5,2,0)=1,VLOOKUP(G1,$A$2:$E$5,5,0)=1)

For you results of just needing 1 or 0 the above would work as true will evaluate to 1 and false will evaluate to 0.

However if you wanted some other result other than 1 and 2 I would change the formula to:

=IF(AND(VLOOKUP(G1,$A$2:$E$5,2,0)=1,VLOOKUP(G1,$A$2:$E$5,5,0)=1),"True Result","False Result")

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