summing an array based on row and column criteria? sumproduct?

mikeross

New Member
Joined
Aug 13, 2013
Messages
19
I'll try to keep this simple, so let's say this is our data

salesunits salesdollarssalesunits salesdollarssalesunits salesdollars
orange4 $ 16.005 $ 20.001 $ 4.00
pear1 $ 2.003 $ 6.0010 $ 20.00
lemon20 $ 60.0015 $ 45.00100 $ 300.00

<tbody>
</tbody>




and you wanted a formula that returned the number of sales units of apples that have been sold in this entire table would be... what formula could you use? the answer to this would be 10 units (for $40 total)

edit: (and a formula that you could drag down to see pear and lemon sales units/dollars/etc... like they won't always be in the same order)


thank you so much! I've been trying different sumproduct/sumif variations for a long time now at work and can't figure anything out
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi and welcome to Mr Excel Forum

Maybe...

A B C D E F G H I J (headers in row 1)
salesunits
salesdollars
salesunits
salesdollars
salesunits
salesdollars
Units
Dollars
orange
4
16
5
20
1
4
10
40
pear
1
2
3
6
10
20
14
28
lemon
20
60
15
45
100
300
135
405

<TBODY>
</TBODY>

Formula in I2
=SUMPRODUCT(--(ISNUMBER(SEARCH(I$1,$B$1:$G$1))),$B2:$G2)

copy across to J2 and down

M.
 
Last edited:
Upvote 0
Excel Workbook
ABCDEFG
1CriteriaSalesunitsSalesdollars
2orange2080
3
4orange2080
5pear2856
6lemon270810
7318946
8
9SalesunitsSalesdollarssalesunitssalesdollarssalesunitssalesdollars
10orange4$16.005$20.001$4.00
11pear1$2.003$6.0010$20.00
12lemon20$60.0015$45.00100$300.00
13orange4$16.005$20.001$4.00
14pear1$2.003$6.0010$20.00
15lemon20$60.0015$45.00100$300.00
165015646142222648
17
4a
Excel 2003
Cell Formulas
RangeFormula
B2=SUMIF($A$10:$A$16,$A2,B10:B16)+SUMIF($A$10:$A$16,$A2,D10:D16)+SUMIF($A$10:$A$16,$A2,F10:F16)
B4=SUMPRODUCT(($A$10:$A$16=$A4)*($B$9:$G$9=$B$1)*($B$10:$G$16))
B16=SUM(B10:B15)
C2=SUMIF($A$10:$A$16,$A2,C10:C16)+SUMIF($A$10:$A$16,$A2,E10:E16)+SUMIF($A$10:$A$16,$A2,G10:G16)
C4=SUMPRODUCT(($A$10:$A$16=$A4)*($B$9:$G$9=$C$1)*($B$10:$G$16))
 
Upvote 0
thank you both! I used Dave Patton's method (from cell B4 and C4) and it worked fine. I added a bunch more criteria like less than/greater than a date, day of week, etc and it all worked perfectly.
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,075
Members
449,205
Latest member
Healthydogs

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