简体   繁体   English

Excel 替换值然后 sumproduct

[英]Excel substituting values and then sumproduct

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.如图所示,l10->r10 成功转换了 l6->r6 的字段。

But now i want it to just write the answer directly, instead of having a seperate field (K10)但现在我希望它直接写答案,而不是有一个单独的字段(K10)

Formula on K10: K10 公式:

=LET(range;L10:R10;SUMPRODUCT(MID(SUBSTITUTE(range;".";":");FIND("-";range)+1;LEN(range)) - LEFT(SUBSTITUTE(range;".";":"); FIND("-";range)-1 ))*24)

Formular on L10: 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!"它们并排成功地工作,但是当我尝试将它们组合起来时,它只会写“#value!” if there is an empty cell如果有一个空单元格

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
    )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM