So I'm currently working on an easier way to plan hours during the week.
What i currently are struggeling with, is that i need to substitute some cells, prior to calculating with them.
As seen on this picture, the l10->r10 successfully translates the fields at l6->r6.
But now i want it to just write the answer directly, instead of having a seperate field (K10)
Formula on K10:
=LET(range;L10:R10;SUMPRODUCT(MID(SUBSTITUTE(range;".";":");FIND("-";range) 1;LEN(range)) - LEFT(SUBSTITUTE(range;".";":"); FIND("-";range)-1 ))*24)
Formular on L10:
=LET(range;L6:R6; IF(range=""; "0-0"; IF(LOWER(range)="fri";SUBSTITUTE(LOWER(range);"fri";"0-0");SUBSTITUTE(range;".";":")) ))
They successfully work, side by side, but when i try to combine them, it just writes "#value!" if there is an empty cell
CodePudding user response:
It works for me if I just nest the second 'let' within the first 'let' like this
=LET(range,LET(range,L6:R6, IF(range="", "0-0", IF(LOWER(range)="fri",SUBSTITUTE(LOWER(range),"fri","0-0"),SUBSTITUTE(range,".",":")) )),
SUMPRODUCT(MID(SUBSTITUTE(range,".",":"),FIND("-",range) 1,LEN(range)) - LEFT(SUBSTITUTE(range,".",":"), FIND("-",range)-1 ))*24)
or in your locale
=LET(range;LET(range;L6:R6; IF(range=""; "0-0"; IF(LOWER(range)="fri";SUBSTITUTE(LOWER(range);"fri";"0-0");SUBSTITUTE(range;".";":")) ));
SUMPRODUCT(MID(SUBSTITUTE(range;".";":");FIND("-";range) 1;LEN(range)) - LEFT(SUBSTITUTE(range;".";":"); FIND("-";range)-1 ))*24)
More readable version produced using Advanced Formula Environment:
=
LET(
range, LET(
range, Sheet1!L6:R6,
IF(
range = "",
"0-0",
IF(LOWER(range) = "fri", SUBSTITUTE(LOWER(range), "fri", "0-0"), SUBSTITUTE(range, ".", ":"))
)
),
SUMPRODUCT(
MID(SUBSTITUTE(range, ".", ":"), FIND("-", range) 1, LEN(range)) -
LEFT(SUBSTITUTE(range, ".", ":"), FIND("-", range) - 1)
) * 24
)