Forum Discussion

michellehit-incnet's avatar
michellehit-incnet
Copper Contributor
Dec 19, 2022

formula help

Hi Everyone, I'm looking for the right formula here.  In one column I have the product type which is either Diesel or Def.  In another column, I have the number of gallons used for that product.  And in separate cells for the "constants" there is the price of Diesel and the price of Def.  So I need the formula to be like:  IF Column A1 equals "Diesel" (the product), multiply Column B1 (# gallons) by constant Cell C (price per gallon).  so that I can have it calculate the price for me and then add up the totals for each Diesel and Def.  Thank you in adv

1 Reply

  • michellehit-incnet 

    Let's say product type is in A2 and down, and gallons used in B2 and down.

    Create a small lookup table, for example in K1:L3

    The formula in C2 is

    =B2*VLOOKUP(A2,$K$2:$L$3,2,FALSE)

    This can be filled down.