Formula to search 3 or more criteria, then count text

Kthom019

New Member
Joined
May 16, 2017
Messages
46
I need help putting together a formula that will do the following:
1. Search for company name "ABC" in column A, then
2. Search for product category "Books" in column B, (there a 6 different product categories that I will be searching for), then
3. Search for product distribution type "truck" in column C, then
4. If the above criteria are met then, count the "alphanumeric codes" in column D
Company NameCategoryDistribution TypeCodes
BookranBookTruck
AP6802400

<colgroup><col></colgroup><tbody>
</tbody>
TelstarBookCart
IM1338917

<tbody>
</tbody>
MajorPenGateCH3117672
BookranBookTruckCS6540201
MajorPenGateTN9358217

<tbody>
</tbody>

I hope the information above is sufficient, I am creating a reporting sheet to pull data from this detailed sheet with thousands of records.

Please assist soonest; thanks.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Welcome to the board. Try:
Code:
=SUMPRODUCT(--($A$1:$A$500="ABC"),--($B$1:$B$500="Books"),--($C$1:$C$500="truck"),$D$1:$D$500)
 
Upvote 0
=COUNTIFS($A:$A,$F1,$B:$B,$G1,$C:$C,$H1,$D:$D,"?*")

where F1 houses a company of interet like Major, G1 a product category like Book, and H1 a distribution type like Truck.
 
Upvote 0
I am using the sumproduct function:

Column A: Company
Column B: Category
SUMPRODUCT(('workbook'!A:A=A2)*('workbook'!B:B=B2)*('Workbook'!C:C="*truck*")*'workbook'!D:D)
This function returns "VALUE" error.
I am obviously using the wrong formula or missing something.
 
Upvote 0
Use COUNTIFS which is faster: See post #3 .

If you can't, try:

=SUMPRODUCT(--($A:$A=$F1),--($B:$B=$G1),--($C:$C=$H1),--ISNUMBER(SEARCH("?*",$D:$D))

Try to avoid whole column references in a SumProduct formula for reasons of efficiency.
 
Upvote 0
@Aladin Akuyrek as a side, I should use COUNTIFs more than SUMPRODUCT as aware it's faster, but with COUNTIFs is using entire column slower than SUMPRODUCT with defined range?
 
Upvote 0
@Aladin Akuyrek as a side, I should use COUNTIFs more than SUMPRODUCT as aware it's faster, but with COUNTIFs is using entire column slower than SUMPRODUCT with defined range?

1. COUNTIFS(A2:A1000,"x",B2:B1000,"y",C2:C1000,"z")

2. SUMPRODUCT(--(A2:A1000="x"),--(B2:B1000="y"),--(C2:C1000="z"))

Using dynamic named ranges, number of records sufficiently large...

3. COUNTIFS(Arange,"x",Brange,"y",Crange,"z")

4. SUMPRODUCT(--(Arange="x"),--(Brange="y"),--(Crange="z"))

5. COUNTIFS(A:A,"x",B:B,"y",C:C,"z")

6. SUMPRODUCT(--(A1:An="x"),--(B1:Bn="y"),--(C1:Cn="z"))

1 and 3 will be faster than their equivalents, i.e. 2 and 4.

If n of [6] is not larger than a limit, it will be faster than [5]. I'm not sure what that n would be.
 
Upvote 0
I learnt about double unary converting TRUE and FALSE into 1 and 0, so intuitively SUMPRODUCT for requirements like this made more sense, but will use COUNTIFs more often, especially if it's faster.

Thank you @Aladin Akyurek for suggesting
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,662
Members
449,462
Latest member
Chislobog

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