Only use data from certain headers/categories/groups

wesleyterrill

New Member
Joined
Feb 9, 2016
Messages
15
Hello, everyone!

Every day, I use several reports that look like the table below (I can export as csv or xlsx.) I need to be able to pull data only from certain headers - specifically all 1900 and 3900 groups. (In my actual data, that will include 1901, 1902, 1903, etc.) But I need to exclude the 2900 categories.

What would be the best way to go about this? If the formula were correct, it should add up the 1900 and 3900 totals: $575 (D4) + $95 (D8) + $450 (D17) + $350 (D20). Any help would be greatly appreciated!


A
BCD
11905 - Doors


2
Invoice #1
$250
3
Invoice #2
$325
4

Total$575
51945 - Windows


6
Invoice #3
$50
7
Invoice #4
$45
8

Total$95
92905 - Maintenance


10
Invoice #5
$25
11

Total$25
122975 - Repair


13
Invoice #6
$40
14

Total$40
153905 - Construction


16
Invoice #7
$450
17
Total$450
183925 - Equipment
19
Invoice #8
$350
20

Total$350

<tbody>
</tbody>
 
1905 - Doors 1905 - Doors19
Invoice #1 2501905 - Doors19
Invoice #2 3251905 - Doors19
Total5751905 - Doors19
1945 - Windows 1945 - Windows19
Invoice #3 501945 - Windows19
Invoice #4 451945 - Windows19
Total951945 - Windows19
2905 - Maintenance 2905 - Maintenance29
Invoice #5 252905 - Maintenance29
Total252905 - Maintenance29
2975 - Repair 2975 - Repair29
Invoice #6 402975 - Repair29
Total402975 - Repair29
3905 - Construction 3905 - Construction39
Invoice #7 4503905 - Construction39
Total4503905 - Construction39
3925 - Equipment 3925 - Equipment39
Invoice #8 3503925 - Equipment39
Total3503925 - Equipment39
1470
formula giving 1470
=SUMPRODUCT(($C$1:$C$20="Total")*($F$1:$F$20=19)*($D$1:$D$20))+SUMPRODUCT(($C$1:$C$20="Total")*($F$1:$F$20=39)*($D$1:$D$20))
a better way maybe is to use a pivot table on my table above
see next post

<colgroup><col><col><col><col><col><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
categoryinvoicetotcolumnamountscategoryexpandedfirsttwodigits
1905 - Doors 1905 - Doors19
Invoice #1 2501905 - Doors19
Invoice #2 3251905 - Doors19
Total5751905 - Doors19
1945 - Windows 1945 - Windows19
Invoice #3 501945 - Windows19
Invoice #4 451945 - Windows19
Total951945 - Windows19
2905 - Maintenance 2905 - Maintenance29
Invoice #5 252905 - Maintenance29
Total252905 - Maintenance29
2975 - Repair 2975 - Repair29
Invoice #6 402975 - Repair29
Total402975 - Repair29
3905 - Construction 3905 - Construction39
Invoice #7 4503905 - Construction39
Total4503905 - Construction39
3925 - Equipment 3925 - Equipment39
Invoice #8 3503925 - Equipment39
Total3503925 - Equipment39
firsttwodigits19firsttwodigits39
with a pivot table you say which firsttwodigits you want
Sum of amounts 19 correctly givesSum of amounts
totcolumnTotal670totcolumnTotal
Total670Total800
(blank)670(blank)800
Grand Total1340copy the pivot table and select 39Grand Total1600
gives 800
now add them
1470
=B28 + L28

<colgroup><col><col><col><col><col><col><col span="4"><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
categoryinvoicetotcolumnamountscategoryexpandedfirsttwodigitsselector
1905 - Doors 1905 - Doors191######problem statement
Invoice #1 2501905 - Doors191
Invoice #2 3251905 - Doors191we want to add the totals for any combination of firsttwodigits
Total5751905 - Doors191
1945 - Windows 1945 - Windows191choose any 2 digits
Invoice #3 501945 - Windows191
Invoice #4 451945 - Windows19119
Total951945 - Windows19139
2905 - Maintenance 2905 - Maintenance290
Invoice #5 252905 - Maintenance290
Total252905 - Maintenance290#####
2975 - Repair 2975 - Repair290=IF(OR(F2=$J$8,F2=$J$9),1,0)
Invoice #6 402975 - Repair290
Total402975 - Repair290
3905 - Construction 3905 - Construction391
Invoice #7 4503905 - Construction391
Total4503905 - Construction391
3925 - Equipment 3925 - Equipment391
Invoice #8 3503925 - Equipment391
Total3503925 - Equipment391
1470
formula
=SUMPRODUCT(($G$2:$G$21=1)*($C$2:$C$21="Total")*($D$2:$D$21))
now you can build on this - I hope
you can have say 10 cells J8 to J17 with "possible" codes
say you choose 3 - other 7 will be blank
put all 10 in the if(or( formula
it will find no blanks so will not affect the calculation
totally autometed !!!

<colgroup><col><col><col><col><col><col><col span="4"><col><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
@Special-K99 - that's correct, but looking at your formula, I think we're really close.

I've been playing around with SUMIFS but I can't quite get it to work. I'm putting: =SUMIFS (D1:D20, C1:C20, "Total", E1:E20, >=1900, E1:E20, <=1999, E1:E20, >=3900, E1:E20, <=3999) but it isn't being accepted by Excel.

=SUMIFS (sum_range, range1, criteria1, [range2], [criteria2], ...)

> = and < = need to be in quotes
 
Upvote 0

Similar threads

Forum statistics

Threads
1,216,174
Messages
6,129,296
Members
449,498
Latest member
Lee_ray

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