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
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,728
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
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)
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,910
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?
 

Andreak14

New Member
Joined
Jun 17, 2012
Messages
3

ADVERTISEMENT

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.
 

Andreak14

New Member
Joined
Jun 17, 2012
Messages
3
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.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,910
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)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,656
Messages
5,597,390
Members
414,141
Latest member
Joey_T92

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