SUMIFS across multiple columns.

Brulcifer

New Member
Joined
Oct 14, 2019
Messages
1
I am looking to count the values of a certain column, based on various criteria across other columns. What I am currently using is:

=(sumifs('Workbook A'!$J:$J,'Workbook A'!$D:$D,$A3,'Workbook A'!$B:$B,">="&CP$1,'Workbook A'!$B:$B,"<="&CP$2)+sumifs('Workbook A'!$J:$J,'Workbook A'!$E:$E,$A3,'Workbook A'!$B:$B,">="&CP$1,'Workbook A'!$B:$B,"<="&CP$2)+sumifs('Workbook A'!$J:$J,'Workbook A'!$F:$F,$A3,'Workbook A'!$B:$B,">="&CP$1,'Workbook A'!$B:$B,"<="&CP$2))-(sumifs(CP$27:CP$33,$B$27:$B$33,$B3))

As you can see, it's the same formula 3x to search once in Column D, Column E, and Column F.

I am searching Workbook A for:
  • A name (which could appear in Columns D, E, or F)
  • That the name falls within a certain date (between CP1 and CP2)

Once I have that info, I am subtracting the total by other criteria I have elsewhere in Workbook B.

Example of Workbook A:


[TABLE="width: 900"]
<tbody>[TR]
[TD]Weekday[/TD]
[TD]Date[/TD]
[TD]Event Name[/TD]
[TD]Employee A[/TD]
[TD]Employee B[/TD]
[TD]Employee C[/TD]
[TD]Client[/TD]
[TD]Start Time[/TD]
[TD]End Time[/TD]
[TD]TOTAL HRS[/TD]
[/TR]
[TR]
[TD]Monday[/TD]
[TD]10/1[/TD]
[TD]Event 1[/TD]
[TD]Mark[/TD]
[TD]Bob[/TD]
[TD][/TD]
[TD="align: center"]--[/TD]
[TD]1:00pm[/TD]
[TD]2:30pm[/TD]
[TD]1.5[/TD]
[/TR]
[TR]
[TD]Tuesday[/TD]
[TD]10/2[/TD]
[TD]Event 2
[/TD]
[TD]Tina[/TD]
[TD]Mark[/TD]
[TD][/TD]
[TD]
--​
[/TD]
[TD]1:30pm[/TD]
[TD]3:30pm[/TD]
[TD]2.0[/TD]
[/TR]
[TR]
[TD]Wednesday[/TD]
[TD]10/3[/TD]
[TD]Event 3[/TD]
[TD]Robert[/TD]
[TD]Adam[/TD]
[TD]Stephen[/TD]
[TD]
--​
[/TD]
[TD]6:00pm[/TD]
[TD]7:30pm[/TD]
[TD]1.5[/TD]
[/TR]
[TR]
[TD]Thursday[/TD]
[TD]10/4[/TD]
[TD]Event 4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
--​
[/TD]
[TD]7:00pm[/TD]
[TD]8:00pm[/TD]
[TD]1.0[/TD]
[/TR]
[TR]
[TD]Friday[/TD]
[TD]10/5[/TD]
[TD]Event 5[/TD]
[TD]Mark[/TD]
[TD]Robert[/TD]
[TD][/TD]
[TD]
--​
[/TD]
[TD]8:20pm[/TD]
[TD]9:20pm[/TD]
[TD]1.0[/TD]
[/TR]
[TR]
[TD]Friday[/TD]
[TD]10/5[/TD]
[TD]Event 6[/TD]
[TD]Mark[/TD]
[TD]Stephen[/TD]
[TD][/TD]
[TD]
--​
[/TD]
[TD]2:00pm[/TD]
[TD]5:00pm[/TD]
[TD]3.0[/TD]
[/TR]
[TR]
[TD]Friday[/TD]
[TD]10/5[/TD]
[TD]Event 7[/TD]
[TD]Adam[/TD]
[TD]Billie[/TD]
[TD]Mark[/TD]
[TD]
--​
[/TD]
[TD]12:00pm[/TD]
[TD]1:30pm[/TD]
[TD]1.5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
If you are after a more compact formula, here it is:

=SUM(SUMIFS('Workbook A'!$J:$J,OFFSET('Workbook A'!$D:$D,,{0,1,2}),$A3,'Workbook A'!$B:$B,">="&CP$1,'Workbook A'!$B:$B,"<="&CP$2))-(SUMIFS(CP$27:CP$33,$B$27:$B$33,$B3))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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