Checking if any of the occurrence for IDs in list 'A' has happened after date in list 'B' for the same ID

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

Checking if any of the occurrence for IDs in list 'A' has happened after date in list 'B' for the same ID

问题

在Table A中,需要查找在任何情况下,其'arrival date_International'在Table B中的'arrival date_Domestic'之后的ID。

英文:

Hope I can find pointer to right direction:

Table 'A' with several IDs reoccurring with different dates (arrival date_Domestic)
Table 'B' with several IDs reoccurring with different dates (arrival date_International)

I need to find IDs where in Table A on any occurrence their 'arrival date_International' was after (>) 'arrival date_Domestic' in Table B

Checking if any of the occurrence for IDs in list 'A' has happened after date in list 'B' for the same ID

I cant just do if date B > date A as it need to check for the particular ID, also tried =IF(MAX(FILTER($F$3:$F$15,$E$3:$E$15=A3))>B3,"Y","N") but it just check against a row not taking ID in consideration.

Any help will be appreciated.

答案1

得分: 3

You need to filter for ID and date.

=IF(SUMPRODUCT((tblA[ID]=[@ID])*(tblA[date_int]>[@[date_dom]])),"Y","N")

Using the new LET-formula might make it more readable:

=LET(maxDateDom,MAX(FILTER([date_dom],[ID]=[@ID])),
     maxDateInt,MAX(FILTER(tblA[date_int],tblA[ID]=[@ID])),
     maxDateInt>maxDateDom)

But you are inconsistent in your question regarding which date to be after which.

If you want date_int < date_dom then switch to tblA[date_int]<[@[date_dom] in the formula.

英文:

You need to filter for ID and date.

=IF(SUMPRODUCT((tblA[ID]=[@ID])*(tblA[date_int]&gt;[@[date_dom]])),&quot;Y&quot;,&quot;N&quot;)

Using the new LET-formula might make it more readable:

=LET(maxDateDom,MAX(FILTER([date_dom],[ID]=[@ID])),
     maxDateInt,MAX(FILTER(tblA[date_int],tblA[ID]=[@ID])),
     maxDateInt&gt;maxDateDom)

But you are inconsistent in your question regarding which date to be after which.

If you want date_int < date_dom then switch to tblA[date_int]&lt;[@[date_dom] in the formula.

Checking if any of the occurrence for IDs in list 'A' has happened after date in list 'B' for the same ID

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

发表评论

匿名网友

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

确定