IF, AND and OR

jamescooper

Well-known Member
Joined
Sep 8, 2014
Messages
834
Trying to get this to work, but I can't quite get it

IF(AND(OR(MATCH(D17,K:K,0)>0,MATCH(E17,L:L,0)>0),SUMPRODUCT(COUNTIF(M:M,TEXT(LEFT(F17,4)-10+ROW(M$1:M$21)-1,"0000")&" "&TRIM(MID(F17,6,100))))>0),"",

The OR statement in bold, the first match is greater than 0 and the second is not, therefore this should be true. Then the SUMPRODUCT part of the formula is also TRUE, so it should return blank, i.e. ""

I am not sure if I have this part correct...OR(MATCH(D17,K:K,0)>0,MATCH(E17,L:L,0)>0)

Any ideas please?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I'm assuming you left off the closing right parenthesis. Just to confirm, are you using the MATCH>0 construction only to confirm that a match is found for either one of the two OR arguments, and if so, you want TRUE? If a match is not found for either one, an #N/A error will occur, and by using two matches in an OR, it is conceivable you'll have OR(TRUE,#N/A), which is not TRUE, but instead will yield a result of #N/A.
 
Upvote 0
Just to confirm, are you using the MATCH>0 construction only to confirm that a match is found for either one of the two OR arguments, and if so, you want TRUE?

That is correct.

I do receive a TRUE and an #N/A and yields an #N/A

How would I modify it do you think?

Thanks.
 
Upvote 0
You might try something like this for the OR(MATCH...replace OR(MATCH(D17,K:K,0)>0,MATCH(E17,L:L,0)>0) with COUNTIF(K:K,D17)+COUNTIF(L:L,E17)
 
Upvote 0
If either finds a match, the number of matches (>0) will be found, otherwise if no match is found, a 0 will be returned for that part of the equation.
 
Upvote 0
Sorry, you probably get my point, but my suggest wasn't quite correct...replace OR(MATCH(D17,K:K,0)>0,MATCH(E17,L:L,0)>0) with (COUNTIF(K:K,D17)+COUNTIF(L:L,E17))>0
 
Upvote 0
IF(AND( (COUNTIF(K:K,D17)+COUNTIF(L:L,E17))>0 ,SUMPRODUCT...
leave the AND and the rest of your formula from SUMPRODUCT onward
 
Upvote 0
Thank you very much; that was helpful. I cannot believe I couldn't solve that - I am better than this.

Must be the time.
 
Upvote 0
There might be better ways to do this, but the suggestion simply checks to see if the number of matches (D17 in the K column or E17 in the L column) are greater than 0, and if so, you'll get the TRUE that you want, otherwise you'll get a FALSE. I think that's what the MATCHes were attempting to do, but this avoids the #N/A error. Otherwise, the rest of your formula stays intact. Glad to help!
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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