使用Google表中的Google表格中的另一列名称(标题)在Arrayformula中的另一列表中引用一列

发布于 2025-01-24 18:11:15 字数 1472 浏览 2 评论 0 原文

我在

我的问题有两个部分。

第1部分

名称表中的

={
    "Is Special";
    ARRAYFORMULA(
        IF(
            A2:A <> "",
            REGEXMATCH(B2:B, "b|d|e"),
        )
    )
}

,在 c1 中,我有此公式:该公式按预期工作,但我不喜欢 b2:b 参考是因为我不容易看出我正在检查哪个列。我宁愿用其名称(在这种情况下为 )参考列。有可能吗?我可以用一些公式或功能替换 b2:b ,可以通过搜索名字来查找列范围?我知道我可以使用匹配获取 的列号,但我不确定如何将其放入此公式中 - 尤其是因为我不能使用 arrayformula 中indrect

类似于:

={
    "Is Special";
    ARRAYFORMULA(
        IF(
            A2:A <> "",
            REGEXMATCH([some formula or function that lets me lookup the column range by searching for "First Name"], "b|d|e"),
        )
    )
}

第2部分

类似于上面的内容,在名称表格上,在 d1 中,我具有此公式:

={
    "Count of one Properties";
    ARRAYFORMULA(
        IF(
            A2:A <> "",
            COUNTIFS(
                properties!A:A, A2:A,
                properties!B:B, "one"
            ),
        )
    )
}

该公式按预期工作。但是,我不喜欢属性!b:b 参考。读取公式,我正在检查的属性>表格中的哪个列并不明显。是否可以通过搜索列名来获得类似的东西,在这种情况下,在这种情况下,在这种情况下,在这种情况下, type ?

I have an example sheet at https://docs.google.com/spreadsheets/d/1i96cjWWGwLQQd2enqQhLylFo31n5GyxbCTcTEPk2I2A/edit#gid=0.

I have two parts to my question.

Part 1

In the names sheet, in C1, I have this formula:

={
    "Is Special";
    ARRAYFORMULA(
        IF(
            A2:A <> "",
            REGEXMATCH(B2:B, "b|d|e"),
        )
    )
}

The formula works as expected but I do not like the B2:B reference because it is not easily obvious what column I am checking against. I'd rather refer to the column by it's name (First Name in this case). Is that possible? Can I replace B2:B with some formula or function that lets me lookup the column range by searching for First Name? I know I can use MATCH to get the column number for First Name but I'm not sure how to put that into this formula -- especially since I cannot use INDRECT in an ARRAYFORMULA.

Something like:

={
    "Is Special";
    ARRAYFORMULA(
        IF(
            A2:A <> "",
            REGEXMATCH([some formula or function that lets me lookup the column range by searching for "First Name"], "b|d|e"),
        )
    )
}

Part 2

Similar to above, on the names sheet, in D1 I have this formula:

={
    "Count of one Properties";
    ARRAYFORMULA(
        IF(
            A2:A <> "",
            COUNTIFS(
                properties!A:A, A2:A,
                properties!B:B, "one"
            ),
        )
    )
}

The formula works as expected. However, I do not like the properties!B:B reference. Reading the formula it is not obvious what column from the properties sheet I am checking against. Is it possible to something similar like above where I get the column range by searching for the column name, in this case type?

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

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

发布评论

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

评论(2

秋意浓 2025-01-31 18:11:15

如果您不喜欢命名范围,请尝试:

={"Is Special"; ARRAYFORMULA(IF(A2:A<>"", 
 REGEXMATCH(FILTER({A2:B, D2:E}, {A1:B1, D1:E1}="First Name"), "b|d|e"), ))}

={"Count of one Properties"; ARRAYFORMULA(IF(A2:A<>"", 
 COUNTIFS(properties!A2:A, A2:A, 
 VLOOKUP(ROW(properties!A2:A),{ROW(properties!A2:A), properties!A2:Z}, 
 MATCH("type", properties!1:1, 0)+1, 0), "one"), ))}

​https://i.sstatic.net/d6oo3.png“ alt =”在此处输入图像说明”>

if you dont like named ranges try:

={"Is Special"; ARRAYFORMULA(IF(A2:A<>"", 
 REGEXMATCH(FILTER({A2:B, D2:E}, {A1:B1, D1:E1}="First Name"), "b|d|e"), ))}

enter image description here

or like:

={"Count of one Properties"; ARRAYFORMULA(IF(A2:A<>"", 
 COUNTIFS(properties!A2:A, A2:A, 
 VLOOKUP(ROW(properties!A2:A),{ROW(properties!A2:A), properties!A2:Z}, 
 MATCH("type", properties!1:1, 0)+1, 0), "one"), ))}

enter image description here

假面具 2025-01-31 18:11:15

不确定您是否熟悉“命名范围”:

​“ https://i.sstatic.net/jgwsp.png” alt =“在此处输入图像描述”>

={"Is Special"; ARRAYFORMULA(IF(A2:A<>"", REGEXMATCH(FirstName, "b|d|e"), ))}

“在此处输入映像”


更新:

={"Is Special"; ARRAYFORMULA(IF(A2:A<>"", 
 REGEXMATCH(QUERY(FirstName, "offset 1", 0), "b|d|e"), ))}

not sure if you are familiar with "named ranges":

enter image description here

enter image description here

={"Is Special"; ARRAYFORMULA(IF(A2:A<>"", REGEXMATCH(FirstName, "b|d|e"), ))}

enter image description here


update:

={"Is Special"; ARRAYFORMULA(IF(A2:A<>"", 
 REGEXMATCH(QUERY(FirstName, "offset 1", 0), "b|d|e"), ))}

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文