Sum based on filter and if statement.

magges

New Member
Joined
Jul 1, 2019
Messages
10
Office Version
  1. 365
Platform
  1. MacOS
Hi All,

I have a bit of challenge in terms of creating an overview of employee hours spent on different projects. The "Total weekly" row 4

As seen on the image below i have employees on project 1 and 2, column A. their weekly hours can be seen from column F. On the image below the sum of the hours is 30 (F4).

Screenshot 2021-05-17 at 16.59.06.png


However i would like to have the "Total weekly" sum being depended on filters. so if i filter to only see "project 1" as below, the sum should adapt to this.
In this case it should be 10 instead of 30.


Screenshot 2021-05-17 at 16.59.30.png



I have tried using SUMPRODUCT combined with an IF statement, but i cannot get to work as intended. At the moment i am only able to get the sum of all cells.
I need the IF statement in order to only sum for the parameter in column E. So in F4 i only get the hours related to "Budget"

Screenshot 2021-05-17 at 17.12.43.png




Is there any way to do this with formulas or do i need a macro for the job?
Link to dropbox with the Excel file from the screenshots
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Have a look at the SUBTOTAL function to see if it will work for you eg =SUBTOTAL(109,F4:F50)
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Excel Formula:
=SUMPRODUCT(SUBTOTAL(109,OFFSET(F16,ROW(F16:F52)-ROW(F16),0,1))*($E$16:$E52=$E4))
 
Upvote 0
Solution
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Excel Formula:
=SUMPRODUCT(SUBTOTAL(109,OFFSET(F16,ROW(F16:F52)-ROW(F16),0,1))*($E$16:$E52=$E4))
Thank you very much. Works perfect
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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