Variable array for countif/sumif?

Myrko

Board Regular
Joined
Jan 26, 2015
Messages
77
Hello,

I'm trying to make a countif / sumif formula which would look into variable row/column based on match function.


I have a table containing ID of a customer and count of drinks he/she has consumed in a period in a Sheet named AV Pivot.

ABCDEFGHI
1IDJuiceJuiceBeerWineJuiceWhiskeyWineBeer
21234512101000
32345600100101
43456720160210

<tbody>
</tbody>

I want to create a separate sheet which will look like this:

ABC
1Customer ID34567
2
3Drink typeSum
4JuiceFORMULA HERE
5Wine
6Whiskey
7Beer

<tbody>
</tbody>

I need a formula which will have the same output as if I wrote:

=SUMIF('AV Pivot'!$1:$1,"="&A4,'AV Pivot'!4:4)

but sum range should be variable based on row in which the ID (found in B1) was found in the source table (Match function can pull row number but I do not know if there is way to create variable array based on result of the match function). I know how I would fix it in VBA but I need macro free workbook.

Thanks in advance!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I think this might do it:


Excel 2012
ABCDEFGHIJKL
1IDJuiceJuiceBeerWineJuiceWhiskeyWineBeer
21234512101000
32345600100101
43456720160210
54567853511352
65678955333502
76790003041003Customer ID34567
87901144544231
99012225130420Drink typeSum
1010123340331324Juice2
1111234430545413Wine7
1212345510224201Whiskey2
1313456645120003Beer1
Sheet53
Cell Formulas
RangeFormula
L10=SUMPRODUCT(--($L$7=$A$2:$A$13)*--($K10=$B$1:$I$1)*$B$2:$I$13)
L11=SUMPRODUCT(--($L$7=$A$2:$A$13)*--($K11=$B$1:$I$1)*$B$2:$I$13)
L12=SUMPRODUCT(--($L$7=$A$2:$A$13)*--($K12=$B$1:$I$1)*$B$2:$I$13)
L13=SUMPRODUCT(--($L$7=$A$2:$A$13)*--($K13=$B$1:$I$1)*$B$2:$I$13)
 
Upvote 0
Thanks for the quick reply but there is one trouble: source is pivot which is variable and it can have more than this few rows/columns from the example. Is it possible to make a formula which will have just a variable rows - based on match function?
 
Upvote 0

Forum statistics

Threads
1,215,558
Messages
6,125,507
Members
449,236
Latest member
Afua

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