Please help with formula

Vitas

New Member
Joined
Feb 26, 2002
Messages
9
I need C1 to return one of four values depending on condition in A1:B1
IF A1=A and B1=B than C1=17
IF A1=A and B1=C than C1=20
IF A1=D and B1=B than C1=25
IF A1=D and B1=C than C1=28

What formula or code should I use?
Can anybody help. Thanks in advance.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Well, the following seems to work OK, but I'm sure there's a better way of doing it; it's also case insensitive: -

=IF(AND(A1="A",B1="B"),17,IF(AND(A1="A",B1="C"),20,IF(AND(A1="D",B1="B"),25,IF(AND(A1="D",B1="C"),28,""))))
 
Upvote 0
On 2002-03-14 00:38, Vitas wrote:
I need C1 to return one of four values depending on condition in A1:B1
IF A1=A and B1=B than C1=17
IF A1=A and B1=C than C1=20
IF A1=D and B1=B than C1=25
IF A1=D and B1=C than C1=28

What formula or code should I use?
Can anybody help. Thanks in advance.

Vitas,

=IF(AND(OR(A1={"A","D"}),OR(B1={"B","C"})),VLOOKUP(A1&B1,{"AB",17;"AC",20;"DB",25;"DC",28},2,0),0)

This formula returns zero if A1 and B1 do not have expected values.

Aladin
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top