Multiple conditions formula

Dsullivanre

New Member
Joined
Dec 12, 2016
Messages
2
Hi Everyone, thanks for taking the time to help me out!

I tried to search in the help in excel, on how to do a multiple condition formula, using If And / IF statements, with no luck.

How do I get the following to be in 1 formula:

A1=0 & B1=0 return in C1 "A"
A1>0 & B1=0 return in C1 "B"
A1=0 & B1>0 return in C1 "C"
A1>0 & B1>0 return in C1 "D"

Thanks again!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

seguin85

Active Member
Joined
Mar 17, 2015
Messages
271
Office Version
  1. 365
Platform
  1. Windows
This should work, in cell C1 enter:
Code:
=IF(A1=0,IF(B1=0,"A",IF(B1>0,"C")),IF(A1>0,IF(B1=0,"B","D")))
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
12,200
Welcome to the forum.

Maybe:

=IF(A1=0,IF(B1=0,"A","C"),IF(B1=0,"B","D"))

This doesn't handle any case where A1 or B1 is less than 0 though. You'd need something like:

=IF(AND(A1=0,B1=0),"A",IF(AND(A1>0,B1=0),"B",IF(AND(A1=0,B1>0),"C",IF(AND(A1>0,B1>0),"D","Something is below 0"))))

to handle that. Or maybe if you have the new IFS function:

=IFS(AND(A1=0,B1=0),"A",AND(A1>0,B1=0),"B",AND(A1=0,B1>0),"C",AND(A1>0,B1>0),"D",TRUE,"Something is below 0")
 

Dsullivanre

New Member
Joined
Dec 12, 2016
Messages
2
Thanks guys! I appreciate the help!

This worked: =IF(AND(A1=0,B1=0),"A",IF(AND(A1>0,B1=0),"B",IF(AND(A1=0,B1>0),"C",IF(AND(A1>0,B1>0),"D","Something is below 0"))))
 

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,747
Too late, but here is a shorter version:

=IF(OR(A1<0,B1<0),"Out of range",IF(A1+B1=0,"A",IF(A1*B1>0,"D",IF(A1=0,"C","B"))))
 

Anand Sharma

Board Regular
Joined
Nov 22, 2016
Messages
63
Hi,

Your conditions is based on A1 and B1, when both conditions meet , try using if with and operator as below

=IF(AND(A1=0,B1=0),"A",IF(AND(A1>0,B1=0),"B",IF(AND(A1=0,B1>1),"C",IF(AND(A1>0,B1>0),"C",""))))
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,899
Messages
5,834,299
Members
430,275
Latest member
Halis

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
Top