SUM with nested IFs returning the wrong value

cherryduck

New Member
Joined
Aug 9, 2017
Messages
4
I'm trying to automate our overtime logging by importing a Sharepoint list into Excel and then automatically adding up all overtime hours done by a person in a day.

The formula I have:

=SUM(IF(Overtime!$E$1:$E$6003=$B19,IF(TEXT(Overtime!$H$1:$H$6003,"mmmm")=$B$3,IF(TEXT(Overtime!$H$1:$H$6003,"DD")=F$6,IF(YEAR(Overtime!$H$1:$H$6003)=$B$4,Overtime!$J$2:$J$6003)))))

Array entered of course.

In this case B19 contains the name of the person doing the overtime, B3 contains the current month, F6 contains the current day, B4 contains the current year, and the J column in the overtime sheet contains the number of hours worked.

This returns a number of hours but it returns the WRONG number of hours. In the cell where the above formula is placed, the matching name and date are in row 3 of the overtime sheet, but the hours returned is coming from J2, ie the cell in the row above. Oddly for row 2, the number of hours worked is being returned from J3 - ie the two are being swapped around.

This is a test with only one overtime event logged per person per day. In another test with people having multiple distinct entries for overtime on any specific date, it is sometimes correct, and sometimes wrong. I'm not sure where I'm gong wrong here.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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