获取不同 ID 数组中日期之间的天数

Obtain days between dates in array of different ID's

我只想获取相同行 ID 的每个日期之间的天数和总天数。 到目前为止,找到了一些代码可以帮助我获取每个日期之间的天数,并分别确定每个当前行是否与前一行相同或不同。我无法同时加入两者,以便仅获得与同一 ID 对应的每个日期之间的相应天数。 Desired result

C2 内的代码:

={"Days Since Previous Payment";ArrayFormula(IFNA(vlookup(row(A3:A),{query(filter(row(A3:A),B3:B>0),"Select * offset 1",0),filter(if({filter(A3:A,B3:B>0);0}*{0;filter(A3:A,B3:B>0)},{filter(A3:A,B3:B>0);0}-{0;filter(A3:A,B3:B>0)},),if({filter(A3:A,B3:B>0);0}*{0;filter(A3:A,B3:B>0)},{filter(A3:A,B3:B>0);0}-{0;filter(A3:A,B3:B>0)},)<>"")},2,0)))}

E3 内的代码,直到 E18:

=ArrayFormula(IF(INDIRECT("B"&(ROW()))<>INDIRECT("B"&(ROW()-1)),INDIRECT("B"&(ROW())),INDIRECT("B"&(ROW()-1))))

以防万一,这是虚拟页面: https://docs.google.com/spreadsheets/d/1HSZKq5JhrHRtl-XPQ6QJF1wNX4e2_5jmyjNK2pPZpDM/edit?usp=sharing

尝试:

=ARRAYFORMULA(A4:A19-A3:A18)

=ARRAYFORMULA(IF(A3:A="",,{0; IF(A4:A1000-A3:A999<0, 0, A4:A1000-A3:A999)}))