Forum Discussion

Matikonis's avatar
Matikonis
Copper Contributor
Mar 10, 2023
Solved

If cell contains specific text from one column, return value located in the same row

Hello,

 

In the first sheet I have a table to calculate product prices, in the second sheet there is a list with product codes in one column and product price next to it. What I am trying to do is to type product code in the first sheet and I want to return the product price value next to the code so I can work further with this data.

This formula works for me:

=IF(B6=Sheet2!B2;Sheet2!D2;0)

 

The problem is that this formula works when I type P-01(first product located in the cell B2 on the second sheet), P-02 works if I type it in the cell B7 and so on. But if I type P-02 in the cell B6 - it does return 0 as the price value.

 

The question is how to improve this formula to be able to type specific product code in any cell of the column and get a product price which is in the same row next to the specific product code.

  • Matikonis 

    =IFERROR(VLOOKUP(B6,Sheet2!$B$2:$D$1000,3,FALSE),"product missing in sheet2")

     

    You can try a lookup formula. If the product doesn't exist in Sheet2 the formula returns a message.

Resources