I am making an electronical salary form for my employees to fill out. As they will be using a tablet to fill out the form, I can't use macros for any functions.
The form has the following functions:
- A determines day of the week, ie "ddd".
- B determines date, defined by simple numbers.
- C is simple text, used as code for shift leaders, or other bonus pay, see J.
- D, E, F is text, any notifications about the shift, etc.
- G determines the start of the shift, f.ex. 18:00
- H determines the end of the shift, f.ex. 02:00
- I counts number of hours worked, in this example 8.
- J applies bonus pay, as determined by C.
- K determines the amount of extra pay for working from 18:00h on fridays, and all hours throughout shifts starting on sundays, counted in number of hours worked.
My problem is getting excel to count hours after 18:00 in the K column, without it counting all hours after 18:00h, even if the shift were to start f.ex. at 19:00h or 23:00h.
I've used this code:
=If(OR(G17="";H17="";I17="";);"";IF(IF(OR(TEXT(A17;"ddd")="fr";TEXT(A17;"ddd")="sa";TEXT(A17;"ddd")="su");I17-(IF(TEXT(A17;"ddd")="fr";18-((G17)*24);0));0)>0;IF(OR(TEXT(A17;"ddd")="fr";TEXT(A17;"ddd")="sa";TEXT(A17;"ddd")="su");I17-(IF(TEXT(A17;"ddd")="fr";18-((G17)*24);0));0);" "))
(I use a Norwegian version of Excel, so I apologize in advance if I've mistranslated any code.)
This code works if the shift on a friday starts before 18:00h (it will start counting hours from 18:00h onwards). But if it starts at a later time, f.ex. at 19:00h, it will count the number of hours from 18:00h, regardless if the shift (G column) starts at a later time.
Any ideas on how to fix this?
Regards, Heine
Bookmarks