Google Sheets公式:比较两列数据中的数据列表

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

Google Sheets Formula: Comparing lists of data in two columns

问题

Incoming Outgoing Same Day
12/5/2022
8/1/2022, 8/10/2022, 8/11/2022, 8/15/2022, 8/16/2022, 8/8/2022
8/11/2022 8/11/2022 True
7/12/2022, 7/9/2022, 10/3/2022, 11/17/2022 10/3/2022, 11/17/2022, 12/25/2022 True
8/10/2022
1/5/2023, 2/29/2023 1/5/2023 True
3/14/2023, 3/15/2023 1/5/2023, 1/6/2023

以下是一个可以用于检查前两列日期是否有相同日期的公式:

=IF(SUMPRODUCT(--(TRANSPOSE(SPLIT(A2, ", "))=SPLIT(B2, ", ")))>0, "True", "")

将这个公式放入第三列的相应单元格,并拖动填充其他单元格,以检查每一行的日期是否匹配。如果匹配,则第三列将显示"True",否则为空白。

英文:
Incoming Outgoing Same Day
12/5/2022
8/1/2022, 8/10/2022, 8/11/2022, 8/15/2022, 8/16/2022, 8/8/2022
8/11/2022 8/11/2022 True
7/12/2022, 7/9/2022, 10/3/2022, 11/17/2022 10/3/2022, 11/17/2022, 12/25/2022 True
8/10/2022
1/5/2023, 2/29/2023 1/5/2023 True
3/14/2023, 3/15/2023 1/5/2023, 1/6/2023

I have a table with two columns, which each contain between zero and many dates delimited by a ", ". I'm trying to develop a formula in a third column that sets a flag if there is one or more match in the prior two columns.

For example, the third, fifth, and seventh rows have the same date in both columns and are thus flagged "True" under the [Same Day] column.

I'm trying something like:

IF(ARRAYFORMULA(SPLIT(", ",... ...),True,)

I think a nested arrayformulas, splits, and/or queries would be appropriate, but it's tricky.

Are there formulas that one can use as operators on sets; like:

SPLIT(", ",[Incoming]) - SPLIT(", ",[Outgoing]) = "Unique Items from [Incoming]" ?

, Any thoughts ?

答案1

得分: 1

=map(A2:A,B2:B,lambda(a,b,if(sum(index(iferror(xmatch(split(a,",",split(b,","))))))>0,true,)))

英文:

<!-- language-all: js -->

You may try:

=map(A2:A,B2:B,lambda(a,b,if(sum(index(iferror(xmatch(split(a,&quot;,&quot;),split(b,&quot;,&quot;)))))&gt;0,true,)))

Google Sheets公式:比较两列数据中的数据列表

huangapple
  • 本文由 发表于 2023年6月25日 23:59:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76551278.html
匿名

发表评论

匿名网友

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

确定