简体   繁体   中英

Excel nested If and VLOOKUP statement

I would like help with making a function to do the following: if the information in a cell is equal to information stored in a list (in another worksheet but in the same workbook) than add that cell + another cell, if false than display FALSE or something else.

I'm new to Excel but a decade ago did a course on visual basic and remember the basic principles of some of these functions. I tried a number of different ways but have not come up with something that works. I've tried nesting VLOOKUP within IF statements as well as HLOOKUP and LOOKUP but had no success.

  • RolledSteel is my product list.
  • List is my worksheet that contains RolledSteel (plus other lists).
  • Invoice is the worksheet that contains the functions that would link to RolledSteel or List .

Functions I have tried but had no success with:

=IF(N10=List!$A$2:$G$13,W10+W10,FALSE)

=IF(N10=RolledSteel,W10+W10,FALSE)

=IF(N10=VLOOKUP(N10,RolledSteel,4,FALSE),W10+W10,FALSE)

I have a few more questions ahead but for now I would like to resolve this issue. Any help would be so very greatly appreciated.

I'm thining the easiest way to do this would be using the Match() function together with If(Isnumber() as follows:

=IF(ISNUMBER(MATCH(N10,RolledSteel,FALSE)),W10+W10,"FALSE")

Basically, you're saying:

  • Look for N10 in the RolledSteel list
  • If it's there, you'll get a number back, so ISNUMBER will be true, so do the sum
  • If it's not, you'll get an error, so ISNUMBER will be false, so return "FALSE"

Hope that makes sense and does the trick

Try the Countif() function. For example, =COUNTIF(List,N10) returns the number of occurrences of the value of N10 in the List. You can expand on that to:

=IF( COUNTIF(List,N10)>0 ,W10+W10 ,FALSE )

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