countifs return values range

sx200apul

New Member
Joined
Sep 17, 2018
Messages
5
=SUM(COUNTIFS(D5:D15,"Mountain Blue",A5:A15,"*"&{1,2,3,4,5,6,7,8,9}&"xWindow*")*{1,2,3,4,5,6,7,8,9})

Counting window colours from Accessories Colour column.

this works fine if its 1-9 in the Extras … but when its 10+ the result is wrong.
What is the best way to make {1,2,3,4,5,6,7,8,9} … 1-99

Below:
Left 2 columns data, right 2 are results using above


Extras
Accessories Colour
Windows
1x30003150, 3x25002770, 2xMotor, 1xPAD, 3xInso
Slate Grey
Heritage Red
1
1x25005100, 1xMotor, 1xPAD
Slate Grey
Mist Green
0
2x25002770, 1xPAD, 1 xWindow
Slate Grey
Mountain Blue
3
Result should be 13
1x30003150, 2x25002770, 9xWindow
Smooth Cream
Slate Grey
5
2x25002770, 4xWindow
Slate Grey
Smooth Cream
10
2x25002770, 12xWindow
Mountain Blue
TOTAL
19
2x25002770, 1xWindow
Slate Grey
2xInso, 6xSideOB, 4xGableOB
Mist Green
1x25002770, 1xPAD, 1xWindow
Smooth Cream
1x25002770, 1xPAD, 1xWindow, 1xInso
Heritage Red
1xWindow, 1xSideOB, 2xGableOB
Mountain Blue
 

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
ROW(INDIRECT("1:99") will make an array {1,2,3...99}

=SUM(COUNTIFS(D5:D15,"Mountain Blue",A5:A15,"*"&ROW(INDIRECT("1:99")&"xWindow*")*ROW(INDIRECT("1:99"))

But then 12xWindow will be counted twice as 2xWindow and 12xWindow
I don't know how to get around that. I'm sure someone clever will figure it out.
 
Upvote 0
If each entry in the EXTRAS column began with a space character, then this would work...

=SUM(COUNTIFS(D5:D15,"Mountain Blue",A5:A15,"* " & ROW(INDIRECT("1:99")&"xWindow*")*ROW(INDIRECT("1:99"))
 
Last edited:
Upvote 0
If each entry in the EXTRAS column began with a space character, then this would work...

=SUM(COUNTIFS(D5:D15,"Mountain Blue",A5:A15,"* " & ROW(INDIRECT("1:99")&"xWindow*")*ROW(INDIRECT("1:99"))

I tried to apply this but Excel rejected it..
see below.. to my sheet as above..
=SUM(COUNTIFS(B5:B15,"Mountain Blue",A5:A15,"* " & ROW(INDIRECT("1:99")&"xWindow*")*ROW(INDIRECT("1:99"))

Just gave an Excel error popup, like Excel couldn't read it.. no result at all..

Any ideas?
 
Upvote 0
=SUM(COUNTIFS(B5:B15,"Mountain Blue",A5:A15,"* " & ROW(INDIRECT("1:99"))&"xWindow*")*ROW(INDIRECT("1:99")))
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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