英文:
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,)))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论