#### JunaidZahoor1985

##### New Member
If d4="2h" and e4=class1
Then 1500*2
If d4="1h" and e4=class1
Then 1500*1
If d4="2h" and e4=class2
Then 3000*2
If d4="1h" and e4=class2
Then 3000*1

#### GraH - Guido

##### Well-Known Member
Hi JunaidZahoor1985 , please read the forum rules to understand the best practices of posting here.

Basic formula = IF (AND (D4= "2H", E4="class1") , 3000 , IF ( AND (D4 = "1H", E4 = "class1") , 1500 , IF ... ) ) )
or using a vlookup on the combination of D4 and E4 and making a reference table to avoid the nesting of IF. = VLOOKUP (D4&E4, lookuptable , 2 , 0)

Lookuptable can be ( 2 columns)
1Hclass1 1500
2Hclass1 3000
1Hclass2 3000
2Hclass2 6000

Why 1500*2 , 3000*2 as hardcoded calculations and not values in your formula?

#### JunaidZahoor1985

##### New Member
Hi JunaidZahoor1985 , please read the forum rules to understand the best practices of posting here.

Basic formula = IF (AND (D4= "2H", E4="class1") , 3000 , IF ( AND (D4 = "1H", E4 = "class1") , 1500 , IF ... ) ) )
or using a vlookup on the combination of D4 and E4 and making a reference table to avoid the nesting of IF. = VLOOKUP (D4&E4, lookuptable , 2 , 0)

Lookuptable can be ( 2 columns)
1Hclass1 1500
2Hclass1 3000
1Hclass2 3000
2Hclass2 6000

Why 1500*2 , 3000*2 as hardcoded calculations and not values in your formula?

#### JunaidZahoor1985

##### New Member
Thanks aLot friend I will check this formula today