Forum Discussion

Fatih_Polat's avatar
Fatih_Polat
Copper Contributor
Feb 07, 2020
Solved

Excel IF-formula

Hi all,

 

I'm looking for the easiest formula for the IF-function. 

 

This is what I'm exactly looking for:

 

If C2 = V-838-NN then N2 has to be € 70,83. 

 

So each licence plate/vehicle has a different daily cost. If we replace V-838-NN with an different vehicle the costs in N2 has to change also. 

 

Is there anyone who can help me with the right formula ?

 

Thanks in advance,

 

Fatih

  • Fatih_Polat 

    You want a more dynamic solution than just with IF. The attached workbook has a simple example how you combine a table containing plates and cost with cell that displays the cost (using VLOOKUP) for a selected plate (using Data Validation).

6 Replies

  • Fatih_Polat 

    If you have only few licence plates say 2 or 3 ,you may go with the IF formulas as it would be easy to maintain the formula. The other downside of the IF formula would be, you will need to place the hard coded costs in the formula so it would be troublesome for you if you ever need to tweak the formula.

    e.g. you may have the following formula in N2

    =IF(C2="V-838-NN",70.83,IF("V-838-NO",75.5,""))

     

    Refer to the 'IF Formula" Sheet in the attached.

     

    I would suggest you to make a Lookup Table as shown on the "Lookup_Table" in the attached and then use the following formula in N2

    =IF(C2="","",IFERROR(VLOOKUP(C2,Lookup_Table!$A:$B,2,0),"Unknown Licence Plate"))

     

    Refer to the "Formula Using Lookup Table" Sheet in the attached.

    The lookup table would be easy to maintain if required and you can add more licence plates in column A and their corresponding costs in column B as many as you want and formula will pick the correct cost as per the licence plate entered in column C.

     

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    Fatih_Polat 

    You want a more dynamic solution than just with IF. The attached workbook has a simple example how you combine a table containing plates and cost with cell that displays the cost (using VLOOKUP) for a selected plate (using Data Validation).