multiple if-and function

leah_v

New Member
Joined
Jun 18, 2012
Messages
7
I am new to excel. I am trying to write a function with 3 conditions, but it does not work. Could you please help me to figure out what error I do?

=IF(AND(A1=1, ISBLANK(B1)),C1=1,IF(AND(A1=2, B1=1),C1=2,IF(AND(A1=2, B1=2),C1=0)))

What I am trying to say: if in column A value is 1 and column B is empty cell, then C should be 1, if column A is 2 and Coulmn B is 1, then C should be 2. Finally, if both columns are 2 then C should be 0.

Thank you for your time!!
 
Last edited:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I am new to excel. I am trying to write a function with 3 conditions, but it does not work. Could you please help me to figure out what error I do?

=IF(AND(A1=1, ISBLANK(B1)),C1=1,IF(AND(A1=2, B1=1),C1=2,IF(AND(A1=2, B1=2),C1=0)))

What I am trying to say: if in column A value is 1 and column B is empty cell, then C should be 1, if column A is 2 and Coulmn B is 1, then C should be 2. Finally, if both columns are 2 then C should be 0.

Thank you for your time!!
This formula entered in C1:

=IF(AND(A1=1,B1=""),1,IF(AND(A1=2,B1=1),2,IF(AND(A1=2,B1=2),0,"")))
 
Upvote 0
It worked just fine! Many-many thanks. T. Valko, for your time. I still try to see what wrong I did, so taht I learn something. Was the problem in referreing to the column C, while I needed just to put the value?
 
Upvote 0
It worked just fine! Many-many thanks. T. Valko, for your time. I still try to see what wrong I did, so taht I learn something. Was the problem in referreing to the column C, while I needed just to put the value?
Yes, that was the problem.

Also, at the very end of the formula you needed to define what to return if NONE of the conditions was met. I have the formula return a blank "".
 
Upvote 0

Forum statistics

Threads
1,203,072
Messages
6,053,377
Members
444,659
Latest member
vuphihung

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