为第三列赋值基于第一列和第二列的数值。

huangapple go评论55阅读模式
英文:

Assigning Values to Third Column Based on Values in First Two Columns

问题

像大多数人一样,我们在正常系统之外使用Excel进行一些报告,具体取决于管理层想要了解的内容。

我们做的许多项目都接受来自多个资金来源的资助,一个常见的问题是,如果项目从任何资金来源获得了资金,那么相关成本是多少,以及与分配给该项目的其他资金来源相比如何。

我们大部分都是通过公式完成这些操作,应该很简单,但在将项目分配到项目时遇到了一些问题。

在这一步中,我只想基于前两列的值填充一列。

举个简单的例子,如果前两列的值如下:

项目 资金
1 NW
1 NW
1 WS
2 WS
2 WS
2 WS
3 NW
3 NW
3 AR
4 AR
4 AR
4 WS

如果我们想要开发涉及NW资金的报告数据,我们希望有一列如下填充的值:

项目 资金 程序
1 NW NW
1 NW NW
1 WS NW
2 WS 未获资助
2 WS 未获资助
2 WS 未获资助
3 NW NW
3 AR NW
3 AR NW
4 AR 未获资助
4 AR 未获资助
4 WS 未获资助

谢谢

英文:

Like most people, we use excel for some reporting outside of our normal system depending upon what management wants to know.

Many of the projects we do receive funding from multiple sources - a common question is, if a project receives any funding from a funding source, what are the associated costs and how does this compare with other funding sources assigned to that project.

We do most of this with formula, and should be simple, but having trouble with a basic step to assign projects to a program.

All I want to do for this step is populate a column based on the values in the first two.

As a simple example, if the values in the first two columns were:

Project Funding
1 NW
1 NW
1 WS
2 WS
2 WS
2 WS
3 NW
3 NW
3 AR
4 AR
4 AR
4 WS

And we wanted to develop the data for developing a report involving funding from NW we would want a third column to be populated with values like this:

Project Funding Program
1 NW NW
1 NW NW
1 WS NW
2 WS Not funded
2 WS Not funded
2 WS Not funded
3 NW NW
3 AR NW
3 AR NW
4 AR Not funded
4 AR Not funded
4 WS Not funded

Thanks

答案1

得分: 1

Using SUMPRODUCT()


• Formula used in cell C2

=IF(SUMPRODUCT(--($A$2:$A$13=A2)*--($B$2:$B$13="NW")),"NW","Not Funded")

Or, Using COUNTIFS()


• Formula used in cell C2

=IF(COUNTIFS($A$2:$A$13,A2,$B$2:$B$13,"NW"),"NW","Not Funded")

Or, If you want a spill array formula then use MAP()


• Formula used in cell C2

=MAP(
    A2:A13,
    B2:B13,
    LAMBDA(x, y,
        IF(
            COUNTIFS(
                x:A2, x,
                y:B2, "NW"
            ),
            "NW",
            "Not Funded"
        )
    )
)
英文:

Using SUMPRODUCT()

为第三列赋值基于第一列和第二列的数值。


• Formula used in cell C2

=IF(SUMPRODUCT(--($A$2:$A$13=A2)*--($B$2:$B$13="NW")),"NW","Not Funded")

Or, Using COUNTIFS()

为第三列赋值基于第一列和第二列的数值。


• Formula used in cell C2

=IF(COUNTIFS($A$2:$A$13,A2,$B$2:$B$13,"NW"),"NW","Not Funded")

Or, If you want a spill array formula then use MAP()

为第三列赋值基于第一列和第二列的数值。


• Formula used in cell C2

=MAP(
    A2:A13,
    B2:B13,
    LAMBDA(x, y,
        IF(
            COUNTIFS(
                x:A2, x,
                y:B2, "NW"
            ),
            "NW",
            "Not Funded"
        )
    )
)

huangapple
  • 本文由 发表于 2023年5月17日 10:43:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76268253.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定