复杂的查找 - 基于列表中的特定值
Complicated lookup - based on specific value in list
我需要一些帮助来找到可以帮助进行非常具体的查找的公式。
我有一个包含 30,000 行的会计电子表格 - 示例摘录如下:
Product Nr. Product Date Purchase or Sale Sale TAT
12345 test product 12345 02.06.2014 Purchase
12345 test product 12345 02.06.2014 Sale 0
12345 test product 12345 30.09.2014 Purchase
12345 test product 12345 30.09.2014 Sale 0
23456 test product 23456 08.01.2014 Purchase
23456 test product 23456 20.01.2014 Sale 12
23456 test product 23456 12.06.2014 Purchase
23456 test product 23456 13.06.2014 Sale 1
23456 test product 23456 30.07.2014 Purchase
23456 test product 23456 04.08.2014 Purchase
23456 test product 23456 04.08.2014 Sale 0
56789 test product 56789 07.01.2014 Sale
56789 test product 56789 13.05.2014 Sale 126
56789 test product 56789 03.12.2014 Sale 204
每一行要么是一次购买,要么是一次销售。我需要一个解决方案,我可以在每次销售时查找之前的购买日期 - 并计算差异。
现在,我只是查找前一行并比较日期 - 当然,这完全不准确 - 因为一次购买可能会有很多次销售。我确实检查了产品编号是否相同,仅此而已。
关于我如何说的任何想法:"for this sale... go back to the last purchase in the list... and use that date."
谢谢!
所以,@Kyle 的回答基本上就是解决方案:
INDEX(C:C, IF(D30="Sale",MAX(IF(D:D="Purchase",IF(C:C<=C30,IF(B:B=B30,ROW(C$2:C)-1)))),""))
谢谢!
我需要一些帮助来找到可以帮助进行非常具体的查找的公式。
我有一个包含 30,000 行的会计电子表格 - 示例摘录如下:
Product Nr. Product Date Purchase or Sale Sale TAT
12345 test product 12345 02.06.2014 Purchase
12345 test product 12345 02.06.2014 Sale 0
12345 test product 12345 30.09.2014 Purchase
12345 test product 12345 30.09.2014 Sale 0
23456 test product 23456 08.01.2014 Purchase
23456 test product 23456 20.01.2014 Sale 12
23456 test product 23456 12.06.2014 Purchase
23456 test product 23456 13.06.2014 Sale 1
23456 test product 23456 30.07.2014 Purchase
23456 test product 23456 04.08.2014 Purchase
23456 test product 23456 04.08.2014 Sale 0
56789 test product 56789 07.01.2014 Sale
56789 test product 56789 13.05.2014 Sale 126
56789 test product 56789 03.12.2014 Sale 204
每一行要么是一次购买,要么是一次销售。我需要一个解决方案,我可以在每次销售时查找之前的购买日期 - 并计算差异。
现在,我只是查找前一行并比较日期 - 当然,这完全不准确 - 因为一次购买可能会有很多次销售。我确实检查了产品编号是否相同,仅此而已。
关于我如何说的任何想法:"for this sale... go back to the last purchase in the list... and use that date."
谢谢!
所以,@Kyle 的回答基本上就是解决方案:
INDEX(C:C, IF(D30="Sale",MAX(IF(D:D="Purchase",IF(C:C<=C30,IF(B:B=B30,ROW(C$2:C)-1)))),""))
谢谢!