sum product subtotal with offset function

gand3rson

New Member
Joined
Jul 28, 2011
Messages
35
Hello new member so thanks in advance for any help I can get <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
I have an excel formula that I am using to calculated dales sales on hand (a financial ration) that is as follows. I found the formula on the net and I am trying to dissect it/understand how it works. The part of the formula I am having difficulty with is <o:p></o:p>
<o:p></o:p>
=SUMPRODUCT(--(SUBTOTAL(9,OFFSET(E4:AB4,,,,COLUMN(E4:AB4)-COLUMN(E4)+1))<=D3))<o:p></o:p>
<o:p></o:p>
I understand that sumproduct with “(--(“ is a way to count cells meeting a specific criteria. In this case the criteria is the number of cells that summed up must be less than cell “D3”. I am just not sure how the subtotal(9) and offset function are being combined to do this. Does anyone have any insight or have a place to point to me where I can read up on combining these three functions?<o:p></o:p>
<o:p></o:p>
Again much thanks<o:p></o:p>
 
Hello Marcelo,

That's right

As discussed in this thread, the formulas in the "Daily Dose of Excel" link are slightly different but the principle is the same - the OFFSET function returns an "array of ranges", ...and when you apply SUBTOTAL function to that array, using 9 in SUBTOTAL you get an array of the sums of those ranges, so in the example here where D4 = 30, E4 = 40 and F4 = 60 then this formula

=SUBTOTAL(9,OFFSET(D4,,,,COLUMN(D4:AA4)-COLUMN(D4)+1))

generates

{30,70,130.......}

It would be the same result as a helper row with this formula in D5 copied across:

=SUM($D4:D4)

SUMPRODUCT isn't actually summing those here - it's comparing that array against C3 (100) and returning the number of elements of that array that are <= C3, i.e. 2 (which gives the 2 from 2.5)
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Barry,

Crystal clear for me now! (the example using SUM($D4:D4) is perfect)

Tks very much for the explanation.

M.
 
Upvote 0

Forum statistics

Threads
1,215,588
Messages
6,125,691
Members
449,250
Latest member
azur3

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