Possible Sum/Index/Lookup Formula?

ekramp

New Member
Joined
Feb 22, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet showing how many hours each employee works per week. I’m trying to get total hours work for a specific date range for specific employees.
I want to be able to:
Input a date into N2 (which would match a date in column A)
Input a date into N3 (which would match a date in column A)
Select an Employee name from a dropdown in N4 (data validation)
Get a total hours for that date range in N5

The total hours for Employee G for date range 22-Jan thru 26-Mar (currently yellow) should be 191.00 hours not the 338.5 it’s calculating. I know it has to incorporate an Employee Lookup somewhere in the formula but I can’t figure that part out. Maybe a Sum/Index/Lookup/Match isn’t the best formula to use either.


hours.xlsx
ABCDEFGHIJKLMNO
1
2Hours SummaryStart Date22-Jan
3End Date26-Mar
4Employee:ABCDEFGHIEmployeeG
5Total Hours338.5
61-Jan45.2544.0040.0041.0040.0046.0045.0040.0036.25
78-Jan46.7543.5040.2540.0040.0046.2551.5040.0039.25
815-Jan62.0044.5041.0040.0040.5046.5051.0041.0040.00
922-Jan62.0043.0040.5040.0041.2546.5048.0040.5040.25
1029-Jan40.0044.0041.5043.0043.0046.2550.0039.5031.25
115-Feb45.0043.0039.0040.0040.7546.2544.5043.5039.25
1212-Feb41.5044.5040.7545.0042.5047.7548.5041.2542.00
1319-Feb---------
1426-Feb---------
155-Mar---------
1612-Mar---------
1719-Mar---------
1826-Mar---------
192-Apr---------
209-Apr---------
2116-Apr---------
2223-Apr---------
2330-Apr---------
247-May---------
2514-May---------
2621-May---------
2728-May---------
284-Jun---------
2911-Jun---------
3018-Jun---------
3125-Jun---------
Sheet1
Cell Formulas
RangeFormula
N5N5=SUM(INDEX(B6:J57,0,MATCH(N4,Employee,0)))
Named Ranges
NameRefers ToCells
Employee=Sheet1!$B$4:$J$4N5
Cells with Data Validation
CellAllowCriteria
N4List=Employee
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi & welcome to MrExcel.
How about
Excel Formula:
=SUM(FILTER(FILTER(B6:J31,(A6:A31>=N2)*(A6:A31<=N3)),N4=Employee))
 
Upvote 0
Solution
Could use.
Excel Formula:
=SUMIFS(INDEX(B6:J57,0,MATCH(N4,B4:J4,0)),A6:A57,">="&N2,A6:A57,"<="&N3)
 
Upvote 0
I only have Excel2010 so I don't know what the Filter function does......but SUMPRODUCT will also work. Using your example above...

=SUMPRODUCT(--(Date>=N2),--(Date<=N3),G)

That formula uses named ranges which correlate with your column headings and range below them.
 
Upvote 0
Hi & welcome to MrExcel.
How about
Excel Formula:
=SUM(FILTER(FILTER(B6:J31,(A6:A31>=N2)*(A6:A31<=N3)),N4=Employee))
This formula worked! I never thought about trying <>= portion. Thanks
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,233
Messages
6,123,771
Members
449,122
Latest member
sampak88

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