excel - Complicated lookup - based on specific value in list -
i need in finding formula can specific lookups.
i have accounting spreadsheet 30,000 rows - example extract below:
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
each row either purchase or sale. need solution can, each sale, lookup previous purchase date - , calculate difference.
right now, lookup previous row , compare dates - of course, totally inaccuate - 1 purchase may have many sales. check if product nr same, that's all.
any ideas on how can say: "for sale... go last purchase in list... , use date."
thanks!
so, @kyle 's answer solution:
index(c$2:c$33, if(d30="sale",max(if(d$2:d$33="purchase",if(c$2:c$33<=c30,if(b$2:b$33=b30,row(c$2:c$33)-1)))),""))
thanks!
Comments
Post a Comment