如何在Excel中排列两组数据?

And*_*imm 4 sorting microsoft-excel-2007 microsoft-excel

如果我有两组数据,如何在 Excel 2007 中排列它们?

例如,如果一组数据有

Position    Occurrences
      8               3
     11               1
     17               2
     18               1
Run Code Online (Sandbox Code Playgroud)

另一组数据有

Position    Occurrences
      8               1
     18               6
Run Code Online (Sandbox Code Playgroud)

我怎样才能把它排成一行

Position    Occurrences     Position    Occurrences
      8               3            8              1
     11               1         
     17               2         
     18               1           18              6
Run Code Online (Sandbox Code Playgroud)

而不是

Position    Occurrences     Position    Occurrences
      8               3            8              1
     11               1           18              6
     17               2         
     18               1         
Run Code Online (Sandbox Code Playgroud)

Mik*_*fro 8

OpenOffice 版本,应该很容易适应 Excel(我认为唯一的区别是 OO 使用分号分隔函数参数,而 Excel 使用逗号):

给定两个标记为“数据集 1”(如下面单元格 A3:B6 所示)和“数据集 2”(如下面单元格 D3:E6 所示)的数据块:

  1. 将数据集 1 复制到一个新范围(如下所示的单元格 A10:B13)。
  2. 在数据集 1 的右侧(显示在单元格 D10 中),输入以下公式:

    =IF(ISNA(VLOOKUP($A10;$D$3:$E$6;1;0));"";VLOOKUP($A10;$D$3:$E$6;1;0))
    
    Run Code Online (Sandbox Code Playgroud)
  3. 与此单元格相邻(显示在单元格 E10 中,输入以下公式:

    =IF(ISNA(VLOOKUP($A10;$D$3:$E$6;2;0));"";VLOOKUP($A10;$D$3:$E$6;2;0))
    
    Run Code Online (Sandbox Code Playgroud)
  4. 将单元格 D10:E10 复制并粘贴到单元格 D11:E13。

这背后的想法是用于VLOOKUP查找与 A 列中的值匹配的单元格。如果未找到匹配的单元格(即VLOOKUP函数返回 N/A 值),则将空字符串放入单元格内容中。如果找到匹配的单元格,则将 VLOOKUP 结果放入单元格内容中。

在此处输入图片说明