SUMIF but with Calculation First

Spyderturbo007

New Member
Joined
Mar 11, 2022
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hopefully someone can help me. I have a printer that spits out data associated with every print job that includes material cost, surface treatment cost, ink volume, etc. Each print job is a different CSV file. I found a way to combine them all using the Data -> Get Data option.
I'm trying to find a way to run a calculation for each print job, but I need it to do a calculation before the summation. I need to take the product of Material Cost Usage and Copy Group Copies and then add them together for each Source.Name.

In the case of these first two it would be =SUM((C2*D14),(C21*D33))

The problem is that there are about 1000 different Source.Name entries in this sheet so doing it manually would be impossible. Ultimately, I'd like to be able to figure out total ink usage as well, but I think if I can get the syntax of one down, I can figure out the others.

Hopefully this makes sense. Thanks so much for the help!
 

Attachments

  • Calculation Example.PNG
    Calculation Example.PNG
    99.2 KB · Views: 21

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
My apologies, but my original screenshot was incorrect. I removed part of the file name for privacy reasons and didn't realize that I filled it down as opposed to copying it down so Excel automatically incremented the number. I'm attaching the correct screenshot to this post.

As for the location of the calculation, it doesn't matter to me. Once I get the syntax of the calculation and the correct function, I can manipulate it to look pretty if needed.

Unfortunately, the software creates a single CSV file during the print job for each file.
 

Attachments

  • Calculation Example.PNG
    Calculation Example.PNG
    104.5 KB · Views: 9
Upvote 0
I would create a hidden helper column after the [Cost Type] column.

Concatenate the values in the [Source.Name] and the [Cost Type] columns in this helper column.

Create a new column and use a formula to do the calculation exampled in the image for each [Source.Name] but only
against the [Cost Type] that is 'Material Cost'.

The sum of this column is what you are after.
 

Attachments

  • Spreadsheet image.JPG
    Spreadsheet image.JPG
    160.4 KB · Views: 7
Upvote 0
@Herakles Thank you for the help! I'm just getting back to this today. Can you help me with the Concatenate part? I am vaguely familiar with that function, but mine ends up as SourceNameCostType stuck together. It looks like yours is separate rows for SourceName and Cost Type.
 
Upvote 0
Are you using CONCATE formula like this?

Excel Formula:
=CONCAT(A2," ",B2)
 
Upvote 0
Try

Book3
ABCDEFGHIJK
1Source NameCost TypeUsageCost
2Source 1Material Cost0.302489Source NameMaterial Cost * Copy Group Copies
3Source 1Surface0.302489Source 10.302489Total59.71391
4Source 1Copy Group Copies1Source 27.411424
5Source 2Material Cost1.852856Source 310
6Source 2Surface1.852856Source 412
7Source 2Copy Group Copies4Source 514
8Source 3Material Cost5Source 616
9Source 3Surface0
10Source 3Copy Group Copies2
11Source 4Material Cost6
12Source 4Surface
13Source 4Copy Group Copies2
14Source 5Material Cost7
15Source 5Surface
16Source 5Copy Group Copies2
17Source 6Material Cost8
18Source 6Surface
19Source 6Copy Group Copies2
20
Sheet2
Cell Formulas
RangeFormula
G3:G9G3=IFERROR(INDEX($C$2:$C$19,MATCH(F3:F9&"Material Cost",$A$2:$A$19&$B$2:$B$19,0))*INDEX($D$2:$D$19,MATCH(F3:F9&"Copy Group Copies",$A$2:$A$19&$B$2:$B$19,0)),0)
J3J3=SUM(IFERROR(INDEX($C$2:$C$19,MATCH(F3:F9&"Material Cost",$A$2:$A$19&$B$2:$B$19,0))*INDEX($D$2:$D$19,MATCH(F3:F9&"Copy Group Copies",$A$2:$A$19&$B$2:$B$19,0)),0))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,011
Members
452,374
Latest member
keccles

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