电子表格多个公式混搭

发布于 2024-12-06 07:04:44 字数 920 浏览 1 评论 0原文

我正在尝试自动化一些任务管理流程,但没有成功。我不能使用宏或类似的东西,只能使用公式,而且我也不擅长电子表格黑客。

无论如何,这是我的工作簿,及其**工作表**

**Form**
TASK     LI    DE    X
Test     1     3
Test2    2

**LI**
WEEK     TASK  COMPLETED
1        Test
2        Test
2        Test  *
4        Test2 *

**DE**
WEEK     TASK  COMPLETED
1        Test  *

我一直在尝试做的是:

  • 在表单上,​​检查哪一列是来自 LI 或 DE,是> 0.
  • 对于每一个> 0,检查其各自工作表(LI 或 DE)上是否存在 TASK。
  • 如果存在,请检查它是否有 *。
  • 如果它有 *,则获取该行的周数,将其与其他工作表中的周数进行比较,获取较大的数字,并将其加载到表单上任务的 X 列中。这里的顺序并不重要。我只需要带 * 的那个星期。

对于此示例,为了更改 X,TASK 必须在其所在的工作表中带有 *。例如,如果在表格上,“测试”在 LI 和 DE 中有数字,并且“测试”在 LI 表中具有 *,但在 DE 表中没有,则 X 必须保留为空。但如果两者都带有 *,则 X 必须加载 LI 和 DE 之间较大的 WEEK。

如果我要使用宏来执行此操作,我只需使用循环检查每一列,但使用公式,我认为嵌套 IF 就足够了。

我尝试过使用 VLOOKUP,但它只获取数组中的第一项,尽管顺序并不重要,但通常(我想我会将其作为策略)是最后一个值。

如有任何疑问,请告诉我!我希望我说清楚了我的问题。

预先非常感谢您!

I’m trying to automate some processes for task management, but I’m having no success. I can’t use macros or similar, just formulas, and I’m not an adept at spreadsheet hacking.

Anyways, here’s my workbook, with its **sheets**:

**Form**
TASK     LI    DE    X
Test     1     3
Test2    2

**LI**
WEEK     TASK  COMPLETED
1        Test
2        Test
2        Test  *
4        Test2 *

**DE**
WEEK     TASK  COMPLETED
1        Test  *

What I’ve been trying to do is:

  • On Form, check which column, from LI or DE, is > 0.
  • For each one > 0, check for the existence of TASK on its respective sheet (LI or DE).
  • If it is there, check if it has an *.
  • If it has an *, take the WEEK number of that row, compare it to the WEEK from the other sheet, take the greater number, and load it into the X column of the TASK on Form. The order here doesn’t really matter. I just need the WEEK from the one with an *.

For this example, in order for X to change, TASK must be with an * in the sheets where it is. For instance, if, on Form, Test has numbers in LI and DE, and Test has an * in LI sheet, but not in DE sheet, X must remain empty. But if both have it with *, X must be loaded with the greater WEEK between LI and DE.

If I were to do it with macros, I would simply check each column with a loop, but with formulas I suppose nested IFs would suffice.

I’ve tried with VLOOKUP, but it only takes the first item in the array, and though the order doesn’t matter, it is generally (I think I will make this a policy) the last value.

Any doubt, just let me know! I hope I made my issue clear.

Thank you very much in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没有心的人 2024-12-13 07:04:44

我认为你可以用公式来做到这一点,但由于你必须循环,你将需要 SUMPRODUCT 或数组公式。

您可以尝试以下公式(使用 CtrlShiftEnter 进行验证):

=MAX((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2))

一些解释:

  • MAX 公式将找到两个工作表的两个数组公式之间的最大值
  • 数组公式的工作原理类似于多重循环测试:
    • (LI!$C$2:$C$5="*") 检查第三列是否有星星
    • (LI!$A$2:$A$5) 将返回周数
    • (LI!$B$2:$B$5=Form!A2) 将检查任务是否相同

我希望我很好地理解您打算做什么: )

[编辑]再次尝试感谢您的评论(这两个任务都必须完成才能出现)

=IF(AND((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2))),MAX((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2)),"")

I think you can do it with formula but as you will have to loop, you will need SUMPRODUCT or Array Formula.

Here is a formula you can try (validate with CtrlShiftEnter):

=MAX((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2))

Some explanation:

  • The MAX formula will find the greatest value between the two ARRAY FORMULA of the two worsheets
  • The array formula works like a multiple loop test:
    • (LI!$C$2:$C$5="*") checks if there is a star in the third column
    • (LI!$A$2:$A$5) will return the week number
    • (LI!$B$2:$B$5=Form!A2) will check if the tasks are the same

I hope I understood well what you intended to do :)

[EDIT] Another try thanks to your comment (both task should be completed to appear)

=IF(AND((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2))),MAX((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2)),"")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文