2D sumif loop?

D

dlh

Is there any way of accomplishing the following in fewer words:

=SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$B$5:$B$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$C$5:$C$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$D$5:$D$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$E$5:$E$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$F$5:$F$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$G$5:$G$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$H$5:$H$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$I$5:$I$1000)
+SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),jan!$J$5:$J$1000)

I thought an array formula might help, but the following doesn't work:

{=SUMIF(jan!$M$5:$M$1000,concatenate("=",C4),offset(jan!$B$5:$B$1000,0,{0,1,2,3,4,5,6,7,8}))}

In other words, how can I get SUMIF to loop through two dimensions?
The most annoying part about it is whenever I click in the cell, most
of the top of the worksheet is hidden behind the long formula displayed
in the edit box.

-dlh
 
R

Roger Govier

Hi

Try the array entered formula
{=SUM(IF($M$5:$M$1000=C4,$B$5:$J$1000)}

Use Ctrl+Shift+Enter to commit or amend the formula.
 
A

Aladin Akyurek

Why not create a total per record in column N, by means of:

=SUM(B5:J5)

and invoking a simple and fast SumIf formula:

=SUMIF(jan!$M$5:$M$1000,"="&C4,jan!$N$5:$N$1000)
 
R

RagDyeR

How about a nice, simple, single formula of:

=SUMPRODUCT((M5:M1000=C4)*(B5:J1000))

--

Regards,

RD
----------------------------------------------------------------------------
-------------------
Please keep all correspondence within the Group, so all may benefit !
----------------------------------------------------------------------------
-------------------


Why not create a total per record in column N, by means of:

=SUM(B5:J5)

and invoking a simple and fast SumIf formula:

=SUMIF(jan!$M$5:$M$1000,"="&C4,jan!$N$5:$N$1000)
 
R

RagDyeR

..

Unless I'm missing a post, all I see there is an *array* formula.<g>
--

Regards,

RD
----------------------------------------------------------------------------
-------------------
Please keep all correspondence within the Group, so all may benefit !
----------------------------------------------------------------------------
-------------------


How about a nice, simple, single formula of:

=SUMPRODUCT((M5:M1000=C4)*(B5:J1000))

That is already done. See Roger's post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Want To Shrink Formula 1
function help, sumif?? 2
If Condition 4
Two Criteria COUNTIF 7
SUMIFS formula with 3 OR Conditions 3
Array formula SUMIF with 2D sum_range array 3
Sumif does not work 2
Month wise Sum 4

Top