Excel 计算每个客户订单之间的日期差异

Excel 计算每个客户订单之间的日期差异

我有一个包含帐户名称、订单 ID 和截止日期的数据集。我想查看每个客户订单之间的天数,但是 Excel 不允许我在数据透视表值中按日期排序,因此我的计算字段无法正常工作。

请参见下面的示例

Account Name    Close Date     Date Diff
Alice       
   74hde72hrg   29/01/2017  
   ery3yrtyhgf  29/01/2017  0
   fdg5rrg3tg3  18/05/2018  474
   fgj465df35y  26/05/2017  -357
   h6hdh54y4    19/04/2018  328
   rfhbswreyg   18/07/2018  90
Bob     
   436yrefg5y   19/04/2018  
   43grey43v    10/05/2017  -344
   54ufhg54y    12/07/2017  63
   sdg3vrf4f4   10/05/2017  -63
Jimmy       
   547feg4gsfd  20/07/2018  
   dfh5heafh5   11/01/2018  -190
   fh35qhrdah   16/01/2018  5
   fha4yfdhg3j  11/01/2018  -5
   fhjwq54jrd5  20/07/2018  190
   g53qyhry35   11/01/2018  -190
   j655hrhg315  20/07/2018  190

请注意,日期不是按顺序排列的,我找不到如何在数据透视表中按顺序排列它们,以便计算字段准确。

我可以在原始数据中进行差异计算,但它也会显示与相邻帐户名称相关的日期之间的差异,而这是我不想要的。

有任何想法吗?

答案1

转换您的

Account Name    Close Date  Date Diff
Alice       
   74hde72hrg   29/01/2017  
   ery3yrtyhgf  29/01/2017  0
   fdg5rrg3tg3  18/05/2018  474
   fgj465df35y  26/05/2017  -357
   h6hdh54y4    19/04/2018  328
   rfhbswreyg   18/07/2018  90
Bob     
   436yrefg5y   19/04/2018  
   43grey43v    10/05/2017  -344
   54ufhg54y    12/07/2017  63
   sdg3vrf4f4   10/05/2017  -63
Jimmy       
   547feg4gsfd  20/07/2018  
   dfh5heafh5   11/01/2018  -190
   fh35qhrdah   16/01/2018  5
   fha4yfdhg3j  11/01/2018  -5
   fhjwq54jrd5  20/07/2018  190
   g53qyhry35   11/01/2018  -190
   j655hrhg315  20/07/2018  190

Owner   Account Name Close Date  Date Diff
Alice   74hde72hrg   29/01/2017  
Alice   ery3yrtyhgf  29/01/2017  0
Alice   fdg5rrg3tg3  18/05/2018  474
Alice   fgj465df35y  26/05/2017  -357
Alice   h6hdh54y4    19/04/2018  328
Alice   rfhbswreyg   18/07/2018  90
Bob     436yrefg5y   19/04/2018  
Bob     43grey43v    10/05/2017  -344
Bob     54ufhg54y    12/07/2017  63
Bob     sdg3vrf4f4   10/05/2017  -63
Jimmy   547feg4gsfd  20/07/2018  
Jimmy   dfh5heafh5   11/01/2018  -190
Jimmy   fh35qhrdah   16/01/2018  5
Jimmy   fha4yfdhg3j  11/01/2018  -5
Jimmy   fhjwq54jrd5  20/07/2018  190
Jimmy   g53qyhry35   11/01/2018  -190
Jimmy   j655hrhg315  20/07/2018  190

该表可以轻松排序——按“所有者”然后按“关闭日期”排序。

相关内容