基于date和单元格值的Microsoft Excel转置

我有这样的原始数据:

01-01-17 Cash Sales 1500 01-01-17 POS 1 50 01-01-17 POS 2 30 02-01-17 Cash Sales 6000 02-01-17 POS 1 150 02-01-17 POS 2 95 03-01-17 Cash Sales 6000 03-01-17 POS 1 150 04-01-17 Cash Sales 2700 04-01-17 POS 2 600 05-01-17 Cash Sales 1000 06-01-17 Cash Sales 7000 06-01-17 POS 1 1000 

我试图从同一天的Cash Sales扣除每天的POS 1POS 2销售额。

我怎样才能在Excel中实现这一点?

我查了Transposefunction,但似乎不会这样做。

我试图达到的最终结果如下所示。 你能帮我吗?

  Cash Sales POS 1 POS 2 01-01-17 Cash Sales 1500 1500 50 30 01-01-17 POS 1 50 01-01-17 POS 2 30 02-01-17 Cash Sales 6000 6000 150 95 02-01-17 POS 1 150 02-01-17 POS 2 95 03-01-17 Cash Sales 6000 6000 150 03-01-17 POS 1 150 04-01-17 Cash Sales 2700 2700 600 04-01-17 POS 2 600 05-01-17 Cash Sales 1000 1000 06-01-17 Cash Sales 7000 7000 1000 06-01-17 POS 1 1000 

你可以试试这个,让我知道它是否有效,

D2开始的公式,拖动到右边并拖动到完整范围,

=IFERROR(IF(AND($B2=$D$1,INDEX($A2:$C$999,MATCH(D$1,$B2:$B$999,0),1)=$A2),INDEX($B2:$C$999,MATCH(D$1,$B2:$B$999,0),2),""),"")

在这里输入图像说明