SOLVED

IF, OR, AND Formulas

%3CLINGO-SUB%20id%3D%22lingo-sub-2121080%22%20slang%3D%22en-US%22%3EIF%2C%20OR%2C%20AND%20Formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2121080%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20it%20possible%20to%20use%20an%20IF(OR(%20formula%20in%20addition%20to%20AND.%3C%2FP%3E%3CP%3EWhat%20I'm%20trying%20to%20do%20is....%3C%2FP%3E%3CP%3EIF%20A2%3D%22At%20Once%22%20AND%20D2%26gt%3BB2%20then%20give%20me%20the%20value%20in%20F2%20if%20False%20give%20me%20%22%20%22%3C%2FP%3E%3CP%3EBUT%3C%2FP%3E%3CP%3EIF%20A2%3D%22Future%22%20and%20C2%26gt%3BB2%20then%20give%20me%20the%20value%20in%20F2%20if%20False%20give%20me%20%22%20%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Clarue_0-1612998052125.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F254047i21DB2BFA59DF94DB%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Clarue_0-1612998052125.png%22%20alt%3D%22Clarue_0-1612998052125.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI'd%20like%20to%20be%20able%20to%20have%20this%20calc.%20all%20in%20one%20formula%20because%20what%20I've%20been%20doing%20is%20just%20filtering%20to%20At%20Once%20and%20Future%20separately%20and%20doing%20a%20simple%20%3DIF(D2%26gt%3BB2%2C(F2)%2C(%22%20%22))%20and%20the%20report%20already%20takes%20enough%20time%20on%20it's%20own%20rather%20not%20go%20through%20the%20filter%20and%20unfilter%20process%20if%20a%20single%20formula%20is%20possible.%20Thanks%20for%20your%20help%20in%20advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2121080%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2121729%22%20slang%3D%22en-US%22%3ERe%3A%20IF%2C%20OR%2C%20AND%20Formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2121729%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F962871%22%20target%3D%22_blank%22%3E%40Clarue%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20took%20another%20look%20at%20this%2C%20and%20an%20unusual%20features%20of%20your%20requirement%20is%20that%20there%20are%20only%20two%20outturns.%26nbsp%3B%20That%20suggest%20that%20only%20one%20condition%20is%20required.%26nbsp%3B%20Building%20the%20condition%20as%20an%20array%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20IF(%0A%20%20OR((%5B%40Type%5D%3D%7B%22Future%22%2C%22At%20once%22%7D)*(Table1%5B%40%5BExp%5D%3A%5BAvailable%5D%5D%26gt%3B%5B%40Requested%5D))%2C%0A%20%20%5B%40Result1%5D%2C%20%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3Bor%20converting%20the%20table%20back%20to%20a%20range%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20IF(%20OR((%24A2%3D%7B%22Future%22%2C%22At%20once%22%7D)*(%24C2%3A%24D2%26gt%3B%24B2))%2C%20%24F2%2C%20%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EAs%20an%20array%20formula%2C%20this%20may%20require%20CSE%2C%20I%20don't%20remember.%26nbsp%3B%20If%20CSE%20were%20required%2C%20using%20SUMPRODUCT%20instead%20of%20OR%20would%20work%20its%20array%20magic.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2121584%22%20slang%3D%22en-US%22%3ERe%3A%20IF%2C%20OR%2C%20AND%20Formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2121584%22%20slang%3D%22en-US%22%3EThank%20you%20so%20much%20for%20your%20help.%20This%20worked%20perfectly.%20I%20think%20I%20was%20making%20it%20more%20difficult%20than%20it%20needed%20to%20be.%20Long%20work%20day%20yesterday.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2121382%22%20slang%3D%22en-US%22%3ERe%3A%20IF%2C%20OR%2C%20AND%20Formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2121382%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F962871%22%20target%3D%22_blank%22%3E%40Clarue%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%20it's%20possible%20to%20use%20AND%20and%20OR%20together%20but%20what%20you%20are%20trying%20doesn't%20needs%20AND%20%26amp%3B%20OR%20together%2C%20since%20in%20A2%20you%20are%20testing%20two%20different%20values.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELike%20if%20A2%3D%22At%20Once%22%20AND%20D2%26gt%3BB2%20should%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf(and(A2%26gt%3B%22At%20Once%22%2CD2%26gt%3BB2)%2CF2%2C0)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnother%20is%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIF(and(A2%3D%22Future%22%2C%20C2%26gt%3BB2)%2CF2%2C0)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EBut%20in%20both%20cases%20you%20are%20getting%20F2%20then%20it%20should%20like%2C%2C%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIF(AND(A2%3D%22At%20Once%22%2CD2%26gt%3BB2)%2CF2%2CIF(AND(A2%3D%22Future%22%2CC2%26gt%3BB2)%2CF2%2C0))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOr%20you%20may%20write%20this%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIF(OR(A%242%3D%22At%20Once%22%2CA%242%3D%22Future%22)%2CIF(OR(D%242%26gt%3BB%242%2CC%242%26gt%3BB%2420)%2CF%242%2C0)%2C0)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3E%3CEM%3EYou%20may%20adjust%20cell%20references%20in%20the%20formula%20as%20needed.%3C%2FEM%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2121151%22%20slang%3D%22en-US%22%3ERe%3A%20IF%2C%20OR%2C%20AND%20Formulas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2121151%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F962871%22%20target%3D%22_blank%22%3E%40Clarue%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUsing%20a%20table%20to%20see%20what%20is%20what%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20IF(%0A%20%20OR(AND(%5B%40Type%5D%3D%22At%20once%22%2C%20%5B%40Available%5D%26gt%3B%5B%40Requested%5D)%2C%0A%20%20%20%20%20AND(%5B%40Type%5D%3D%22Future%22%2C%20%20%20%20%20%20%20%20%5B%40Exp%5D%26gt%3B%5B%40Requested%5D))%2C%0A%20%20%5B%40Open%5D%2C%0A%20%20%20%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Efollows%20your%20description.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Is it possible to use an IF(OR( formula in addition to AND.

What I'm trying to do is....

IF A2="At Once" AND D2>B2 then give me the value in F2 if False give me " "

BUT

IF A2="Future" and C2>B2 then give me the value in F2 if False give me " "

 

Clarue_0-1612998052125.png

I'd like to be able to have this calc. all in one formula because what I've been doing is just filtering to At Once and Future separately and doing a simple =IF(D2>B2,(F2),(" ")) and the report already takes enough time on it's own rather not go through the filter and unfilter process if a single formula is possible. Thanks for your help in advance.

 

5 Replies

@Clarue 

Using a table to see what is what

= IF(
  OR(AND([@Type]="At once", [@Available]>[@Requested]),
     AND([@Type]="Future",        [@Exp]>[@Requested])),
  [@Open],
   "")

follows your description. 

Best Response confirmed by Clarue (New Contributor)
Solution

@Clarue 

 

Yes it's possible to use AND and OR together but what you are trying doesn't needs AND & OR together, since in A2 you are testing two different values. 

 

Like if A2="At Once" AND D2>B2 should 

 

If(and(A2>"At Once",D2>B2),F2,0)

 

Another is 

 

IF(and(A2="Future", C2>B2),F2,0)

 

But in both cases you are getting F2 then it should like,,

 

=IF(AND(A2="At Once",D2>B2),F2,IF(AND(A2="Future",C2>B2),F2,0))

 

Or you may write this:

=IF(OR(A$2="At Once",A$2="Future"),IF(OR(D$2>B$2,C$2>B$20),F$2,0),0)

 

  • You may adjust cell references in the formula as needed.
Thank you so much for your help. This worked perfectly. I think I was making it more difficult than it needed to be. Long work day yesterday.

@Clarue 

I took another look at this, and an unusual features of your requirement is that there are only two outturns.  That suggest that only one condition is required.  Building the condition as an array

= IF(
  OR(([@Type]={"Future","At once"})*(Table1[@[Exp]:[Available]]>[@Requested])),
  [@Result1], "")

 or converting the table back to a range

= IF( OR(($A2={"Future","At once"})*($C2:$D2>$B2)), $F2, "")

As an array formula, this may require CSE, I don't remember.  If CSE were required, using SUMPRODUCT instead of OR would work its array magic.

 

@Clarue Glad to help you please keep asking ☺