SUMIF with variable Sum_Range

AlbertV

New Member
Joined
Sep 15, 2009
Messages
4
I am working on a spreadsheet that calculates the monthly price based on the number of active support criteria. Normally I would use a standard SUMIF function, however the column it uses for the sum range needs to be variable based on a criteria (month).

A B C D
Jan-09 Feb-09
Server1 Basic 1 0
Server2 High 1 1
Server3 Basic 0 1

So normally I would use SUMIF(B:B,"Basic",C:C), but now I need it to have the C:C variable based on on the month.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Something like this:

=SUMPRODUCT((B2:B4="Basic")*(TEXT(C1:D1,"mmm")="Jan"),C2:D4)

where dates are in C1:D1

Adjust ranges to suit (don't use whole column references, use defined ranges)

Also, you can replace "Jan" with a cell reference containing "Jan" without quotes, so that you can be more flexible.
 
Upvote 0
You could use SUMIF with an INDEX function for the range to sum, e.g.

=SUMIF(B2:B100,"Basic",INDEX(C2:N100,0,MATCH(P1,C1:N1)))

where P1 contains a date in the month you want to sum, C1:N1 contains the 1st of each month
 
Upvote 0
NBVC, thanks very much, I knew it should be possible with INDEX MATCH, but was not able to get it right. Works as a dream.

Barry, I have tried the Sumproduct one as well, but could not get it to work (probably me).

Thanks for you help,

Albert
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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