Mar 17 2023 02:39 AM - edited Mar 17 2023 04:10 AM
I have an issue with some code. I would like it to return a 1 or a 0 depending on whether the employee worked with the company that month.
the issues I have are as follows:
1. An employee starts on the 25th of the month, but the code doesn't count that month, so it returns a 0.
2. instead of returning a "0", I am getting "False".
Mar 17 2023 03:42 AM - edited Mar 17 2023 04:08 AM
The part
IF(NUMBERVALUE($C2)>NUMBERVALUE(F$1),IF(NUMBERVALUE($C2)<NUMBERVALUE(F$1),...
makes no sense: $C2 cannot be greater than F$1 and less than F$1 at the same time.
Don't you want to take the termination date into account?
Mar 17 2023 03:51 AM - edited Mar 17 2023 04:09 AM
@Hans Vogelaar yes I realised after I posted that there was an additional bit copied that shouldn't be there. I'd like it to be a 1 if they were part of the company that month, and a "0" if they were not, either before or after employment.
I have changed the Code to include letters so I can see exactly which bit it's being pulled from.
=IF($D2<>"",IF(NUMBERVALUE($C2)>NUMBERVALUE(AP$1),"A","B"),IF(NUMBERVALUE($C2)<NUMBERVALUE(AP$1),IF(OR(NUMBERVALUE($E2)>NUMBERVALUE(AP$1), NUMBERVALUE($E2)="C"),"D","E"),"F"))
Mar 17 2023 04:17 AM
Solution=(NUMBERVALUE(F$1)<=IF($D2="", IF($E2="", DATE(9999, 12, 31), NUMBERVALUE($E2)), NUMBERVALUE($D2)))*(EOMONTH(NUMBERVALUE(F$1), 0)>=NUMBERVALUE($C2))
Fill down, then to the right (or vice versa)
Mar 17 2023 04:43 AM
Mar 17 2023 04:17 AM
Solution=(NUMBERVALUE(F$1)<=IF($D2="", IF($E2="", DATE(9999, 12, 31), NUMBERVALUE($E2)), NUMBERVALUE($D2)))*(EOMONTH(NUMBERVALUE(F$1), 0)>=NUMBERVALUE($C2))
Fill down, then to the right (or vice versa)