I'm trying to make a script for a custom function in google spreadsheet to work out the hours worked in a day function hwtd()
. I've got it perfect in the cell (((F8-E8)+(F9-E9))+(IF((F10<E10), (F10-E10+$Q$3), (F10-E10))))
with the host cell being F11 through its long winded to type out and copy/paste breaks my flow of work.
My problem is after searching I can't work out how to reference cells relative to the host cell i.e. [cell 3 above] - [cell 3 above and 1 left] = hours in shift 1 of 3
(then repeated again for shift 2 & 3 before adding them all together).
The math I can do, it's just the referencing from the host cell. What is the best way to resolve this and are you able to explain it as well?