Forum Discussion
Sum of Range based on numbers in a different row
Hi, I would appreciate any help I can receive on this spreadsheet, which is being used for tracking employee absence. I am trying to sum the total of a range.(the sum of the hours taken in the month). This is for an employee who is working a flexible schedule and is not working the same amount of hours each day. The issue is if the employee is off for the full day there is an X in the field. That X is represented by a value in the row directly above it; each day in the month is given a value. If the employee is off for only a partial work day, the number of hours is entered into the field instead of the X. I have attached a sample of the spreadsheet, which should help better explain what I am trying to accomplish. Thank you.
=SUM((B5:AF5="X")*(B$4:AF$4),B5:AF5)or for older versions of Excel:
=SUMPRODUCT((B5:AF5="X")*(B$4:AF$4),B5:AF5)
7 Replies
- Detlef_LewinSilver Contributor
=SUM((B5:AF5="X")*(B$4:AF$4),B5:AF5)or for older versions of Excel:
=SUMPRODUCT((B5:AF5="X")*(B$4:AF$4),B5:AF5)- Jos_WoolleyIron Contributor
I think you need to check your second formula with SUMPRODUCT, which does not give correct results in any version of Excel.
Regards
- Detlef_LewinSilver Contributor
- Templar70Copper Contributor
This is exactly what I needed. I'm using Office 365, so the first formula works perfectly. Thank you so much!!