简体   繁体   English

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

[英]Microsoft Excel Transpose Based on Date and Cell Value

I've got raw data like this: 我有这样的原始数据:

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

I'm trying to deduct the POS 1 and POS 2 sales of each day from the Cash Sales for that same day. 我正在尝试从同一天的Cash Sales扣除每天的POS 1POS 2销售额。

How can I achieve this in Excel? 如何在Excel中实现?

I've looked up the Transpose function, but seems like that won't do for this. 我已经查看了Transpose函数,但似乎无法做到这一点。

The end results I'm trying to achieve are like below. 我想要达到的最终结果如下。 Can you help? 你能帮我吗?

                                    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                

Can you try this and let me know if it works, 您可以尝试一下,让我知道是否可行,

Formula starting from D2 , drag to right and drag down to the complete range, 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),""),"")

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM