If and or statement not working

Andreak14

New Member
Joined
Jun 17, 2012
Messages
3
SO i am trying to add columns to establish events. In the one scenario I have four columns and one is basically a parent field and has four child fields. Two of the fields have to be added if the parent is greater than zero. The formula does not seem to be working.

=T2+AA2+AC2+AY2+IF(AND(U2=1,OR(X2=1,Y2=1)),1,0)

So the U2 is the parent field and If either the x2=1 or the y2=1 then add a one (1) if not zero (0). It can also be x2=1 and y2=1.

Cannot figure out why its not working any ideas would be great.

Andi
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi and welcome to the Board
This works for me
Code:
=IF(AND(U2=1,OR(X2=1,Y2=1)),1,0)+SUM(T2+AA2+AC2+AY2)
 
Upvote 0
It looks like it should work to me.
Can you give an example of T2, AA2, AC2, AY2, U2, X2 and Y2 with the desired result that doesn't act the way you want?
 
Upvote 0
It looks like it should work to me.
Can you give an example of T2, AA2, AC2, AY2, U2, X2 and Y2 with the desired result that doesn't act the way you want?



Ok, thanks everyone, here is an example

T2=0, AA2=0, AC2=0, AY2=0, u2=1, x2=1, y2=0
I am getting a total of 0
I should get a total of 1 due to the if u2=1, x2=1 and sum in with the equation, correct?

Hope this helps.
 
Upvote 0
Thank you everyone, sorry but just realized that the child fields came over from access formatted as Text. Once I converted to number the formulas worked. Sorry to waste your time.
 
Upvote 0
The formula in the OP returns 1 for the data you gave.
Is it possible that some U1, X1 or Y1 are text instead of numbers? (e.g. the string "1" rather than the number 1)
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,026
Members
449,061
Latest member
TheRealJoaquin

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