IF OR and AND formular, help!.... I want to use so much criteria, Im toally stumped..

novabond

New Member
Joined
Mar 26, 2022
Messages
32
Office Version
  1. 365
Platform
  1. Windows
hello.

Im really stuck, I hope someone can help.

The formular I am looking for has this criteria:

  • formular in cell S28 (i will refer to this cell as Output cell)
    • If there is a "P" in cell $BA28 (I will refer to this cell as Include cell)
      • value if true :
        • If there is text in either S$11 OR S$15 (I will refer to this range as set A) and it matches part of text in $BN28 (i will refer to this cell as Lookup cell)
        • AND
        • If there is text in either S$19 OR S$23 (i will refer to this range as set B) and it matches part of text in $BN28 (as above)
          • = "P"
      • value if false :
          • = "" (blank)

note, (as i want to try, and best explain the criteria still)
so it will also be that,

If there is a "P" in Include cell
and
If there is text in one or both cells is set A, and both or one of these text doesnt match part text in Lookup cell
AND
If there is text in one or both cells is set B, and both or one of these text does match part text in Lookup cell
or visa versa
I need this to return "" (blank) in the Output cell

and

I was also struggling with a simple way to get the formular, not to recognise an empty cell in sets A or B, as being matched as TRUE, with part text in the Lookup cell

btw, I use "P" in cells, whereby I was to display a tick, by also having font Wingdings 2......

and

as per the illustration image below, I will be copying this formular to other cells.
1666263580096.png


but, I can eaisly rename the cells in the formular myself, if you want to write this formular uisng the first cells in a worksheet say:
(NB: I wanted to include my actual cell references earlier, incase it becuase relevent in the overall solution, I also cant get XL2BB to work for me at the moment, so cant drop in minisheets to help)
A$1:A$2, set A
A$3:A$4, set
B
A5, Output cell
$J5, Include call
$K5, Lookup cell


1666267404918.png




thanks so much for reading this!... fingeres crossed someone wants to take it on... tnanks again !
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
formular in cell S28 (i will refer to this cell as Output cell)
  • If there is a "P" in cell $BA28 (I will refer to this cell as Include cell)
    • value if true :
      • If there is text in either S$11 OR S$15 (I will refer to this range as set A) and it matches part of text in $BN28 (i will refer to this cell as Lookup cell)
      • AND
      • If there is text in either S$19 OR S$23 (i will refer to this range as set B) and it matches part of text in $BN28 (as above)
        • = "P"
    • value if false :
        • = "" (blank)
Try this -

Excel Formula:
=IF(AND($BA28="P",AND(OR(S$11<>"",S$15<>""),OR(Find(S$11,$BN26)>0,Find(S$15,$BN28)>0)),AND(OR(S$19<>"",S$23<>""),OR(Find(S$19,$BN26)>0,Find(S$23,$BN28)>0))),"P","")
 
Upvote 0
Try this -

Excel Formula:
=IF(AND($BA28="P",AND(OR(S$11<>"",S$15<>""),OR(Find(S$11,$BN26)>0,Find(S$15,$BN28)>0)),AND(OR(S$19<>"",S$23<>""),OR(Find(S$19,$BN26)>0,Find(S$23,$BN28)>0))),"P","")
Hi Sanjay, thank you for this.... It doesnt seem to work as it is...

IncludeLookup
Result of Formular should bePPPPPPPPP
set Ayepoutyepyepoutoutoutyepyepyepout
outoutoutinoutyepoutininout
set Boutyepinyepyepoutyepoutinoutyepyep
outoutoutyepoutoutinin
FormularTRUETRUETRUETRUETRUEPyep in
 
Upvote 0
Try this -

Excel Formula:
=IF(AND($BA28="P",AND(OR(S$11<>"",S$15<>""),OR(Find(S$11,$BN26)>0,Find(S$15,$BN28)>0)),AND(OR(S$19<>"",S$23<>""),OR(Find(S$19,$BN26)>0,Find(S$23,$BN28)>0))),"P","")
me again.... i have been able to insert the table with XL2BB now, incase you want to take a look, Im also going to close this thread and start a new one so I can include the table from the start, I hope to see you there... thank you again!
 

Attachments

  • 1666345139759.png
    1666345139759.png
    14.9 KB · Views: 3
Upvote 0
Hi Sanjay, thank you for this.... It doesnt seem to work as it is...
I copied your XL2BB file to check the problem - It's giving strange formula you have put. Please check the formula and cell references.
 
Upvote 0
hey
I copied your XL2BB file to check the problem - It's giving strange formula you have put. Please check the formula and cell references.
hey, is this any better?
Bank_Vat_and_Departments_Return_WORKING_DocNOWNEW.xlsm
BCDEFGHIJKLMNOPQRST
2IncludeLookup
3Result of Formular should bePPPPPPPPP
4set Ayepoutyepyepoutoutoutyepyepyepout
5outoutoutinoutyepoutininout
6set Boutyepinyepyepoutyepoutinoutyepyep
7outoutoutyepoutoutinin
8Formular    TRUETRUE TRUE     TRUE TRUEPyep in
or and or workings (3)
Cell Formulas
RangeFormula
C8:R8C8=IFERROR(IF(AND($S8="P",AND(OR(C$4<>"",C$5<>""),OR(FIND(C$4,$T8)>0,FIND(C$5,$T8)>0)),AND(OR(C$6<>"",C$7<>""),OR(FIND(C$6,$T8)>0,FIND(C$7,$T8)>0))),"P","")=IF(AND($S8="P",AND(OR(C$4<>"",C$5<>""),OR(FIND(C$4,$T8)>0,FIND(C$5,$T8)>0)),AND(OR(C$6<>"",C$7<>""),OR(FIND(C$6,$T8)>0,FIND(C$7,$T8)>0))),"P",""),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C3:R3Cell Value=0textNO
C3:R3,C8:R8Expression=C$3="P"textNO
N7Cell Value=0textNO
G7:M7,O7:R7Cell Value=0textNO
B7:F7Cell Value=0textNO
N6Cell Value=0textNO
G6:M6,O6:R6Cell Value=0textNO
B6:F6Cell Value=0textNO
N5Cell Value=0textNO
G5:M5,O5:R5Cell Value=0textNO
B5:F5Cell Value=0textNO
B4:R4Cell Value=0textNO
 
Upvote 0
hmm....
I copied your XL2BB file to check the problem - It's giving strange formula you have put. Please check the formula and cell references.
hmm i see what you mean... unsure why the formulars are jumping around... ive tried adjusting the colum width incase that helps...

IFORAND.xlsx
BCDEFGHIJKLMNOPQRST
2IncludeLookup
3Should outputPPPPPPPPP
4set Ayepoutyepyepoutoutoutyepyepyepout
5outoutoutinoutyepoutininout
6set Boutyepinyepyepoutyepoutinoutyepyep
7outoutoutyepoutoutinin
8Formular    TRUETRUE TRUE     TRUE TRUEPyep in
if and or workings
Cell Formulas
RangeFormula
C8:R8C8=IFERROR(IF(AND($S8="P",AND(OR(C$4<>"",C$5<>""),OR(FIND(C$4,$T8)>0,FIND(C$5,$T8)>0)),AND(OR(C$6<>"",C$7<>""),OR(FIND(C$6,$T8)>0,FIND(C$7,$T8)>0))),"P","")=IF(AND($S8="P",AND(OR(C$4<>"",C$5<>""),OR(FIND(C$4,$T8)>0,FIND(C$5,$T8)>0)),AND(OR(C$6<>"",C$7<>""),OR(FIND(C$6,$T8)>0,FIND(C$7,$T8)>0))),"P",""),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C3:R3Cell Value=0textNO
C3:R3,C8:R8Expression=C$3="P"textNO
N7Cell Value=0textNO
G7:M7,O7:R7Cell Value=0textNO
B7:F7Cell Value=0textNO
N6Cell Value=0textNO
G6:M6,O6:R6Cell Value=0textNO
B6:F6Cell Value=0textNO
N5Cell Value=0textNO
G5:M5,O5:R5Cell Value=0textNO
B5:F5Cell Value=0textNO
B4:R4Cell Value=0textNO
 
Upvote 0
Check below -

As my suspicion was, you had put wrong formula
  • In cell C8 I have corrected the formula
  • While in D8 I have kept formula that you have used, so that you could recognize change & error.
  • In Cell C8 it is returning Blank as the conditions given it should return blank only.
Please check and revert.

All Records.xlsb
ABCDEFGHIJKLMNOPQRST
1
2IncludeLookup
3Result of Formular should bePPPPPPPPP
4set Ayepoutyepyepoutoutoutyepyepyepout
5outoutoutinoutyepoutininout
6set Boutyepinyepyepoutyepoutinoutyepyep
7outoutoutyepoutoutinin
8Formular    TRUETRUE TRUE     TRUE TRUEPyep in
Sheet2
Cell Formulas
RangeFormula
C8C8=IF(AND($S8="P",AND(OR(C$4<>"",C$5<>""),OR(IFERROR(FIND(C$4,$T8),0)>0,IFERROR(FIND(C$5,$T8),0)>0)),AND(OR(C$6<>"",C$7<>""),OR(IFERROR(FIND(C$6,$T8),0)>0,IFERROR(FIND(C$7,$T8),0)>0))),"P","")
D8:R8D8=IFERROR(IF(AND($S8="P",AND(OR(D$4<>"",D$5<>""),OR(FIND(D$4,$T8)>0,FIND(D$5,$T8)>0)),AND(OR(D$6<>"",D$7<>""),OR(FIND(D$6,$T8)>0,FIND(D$7,$T8)>0))),"P","")=IF(AND($S8="P",AND(OR(D$4<>"",D$5<>""),OR(FIND(D$4,$T8)>0,FIND(D$5,$T8)>0)),AND(OR(D$6<>"",D$7<>""),OR(FIND(D$6,$T8)>0,FIND(D$7,$T8)>0))),"P",""),"")
 
Upvote 0

Forum statistics

Threads
1,215,231
Messages
6,123,754
Members
449,118
Latest member
kingjet

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