Alternative to COUNTIFS with different sized ranges?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
871
Office Version
  1. 365
  2. 2019
Hi all,

From what I've been able to find, this function only works when range1 and range 2 are the same size (i.e 1 column each in my case). This works great when my formula is this:

=IF(COUNTIFS('Current Order Numbers'!$B:$B,$A3,'Current Order Numbers'!$H:$H,"*"&BA2&"*")>0,"Y","N")

However, I now need to extend the range2 to look not just in column H, but in 3 columns, so I want to change my formula to:

=IF(COUNTIFS('Current Order Numbers'!$B:$B,$A3,'Current Order Numbers'!$H:$J,"*"&BA2&"*")>0,"Y","N")

Essentially, now looking for the value in BA2 to not just a wildcard search in column H, but also column I and column J.

This breaks the formula. What's my solution?

Thank you!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
If only one appereance in one of the three columns is enough then use 3x COUNTIFS
 
Upvote 0
Try this:
Excel Formula:
=IF((COUNTIFS('Current Order Numbers'!$B:$B,$A3))*(COUNTIFS('Current Order Numbers'!$H:$H,"*"&BA2&"*")+COUNTIFS('Current Order Numbers'!$I:$I,"*"&BA2&"*")+COUNTIFS('Current Order Numbers'!$J:$J,"*"&BA2&"*"))>0,"Yes","No")
 
Upvote 0
Thank you both. mart37, I was starting to add the 3 statements when maabadi posted his.

maabadi, I am now using this formula:

=IF($A3="","",IF((COUNTIFS('Current Order Numbers'!$B:$B,$A3))*(COUNTIFS('Current Order Numbers'!$H:$H,"*"&BA$2&"*")+COUNTIFS('Current Order Numbers'!$I:$I,"*"&BA$2&"*")+COUNTIFS('Current Order Numbers'!$J:$J,"*"&BA$2&"*"))>0,"Y","N"))

However, it is giving some strange results, and I can't understand why. For instance, when A3 has a match in $B:$B on the other worksheet, but when there are no matches to BA2 on its row, it is still displaying a Y.

Is it actually giving a Y when it finds a match in the entire H, I, or J columns, instead of just the respective rows?

Thank you!
 
Upvote 0
I supposed you want to find second criteria at total columns not specific row based your first formula.
Excel Formula:
 =IF((COUNTIFS('Current Order Numbers'!$B:$B,$A3))*(COUNTIFS('Current Order Numbers'!$H2,"*"&BA2&"*")+COUNTIFS('Current Order Numbers'!$I2,"*"&BA2&"*")+COUNTIFS('Current Order Numbers'!$J2,"*"&BA2&"*"))>0,"Yes","No")
And drag it down.
 
Upvote 0
Hi maabadi..... I think this is working.... but I am actually confused as to what is happening! :)

It just so happens that the order/contents of column A matches the order/contents of column B on Current Order Numbers.

Is that they only reason this is working? Because otherwise, I'm confused about how we were from a fixed column range search, H:H, to H2, and incrementing as I drag the formula down, and it still works :)
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

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