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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,215,487
Messages
6,125,086
Members
449,206
Latest member
ralemanygarcia

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