一系列单元格的重复值

一系列单元格的重复值

我有一个包含 3 列的 Excel 文件。第一列包含国家/地区代码,第二列包含国家/地区名称,第三列包含年份。

总共我有 354 个不同的国家/地区值和 37 个不同的年份(从 1980 年到 2016 年)。

以下是我的文件的简化示例。此示例中有 3 个不同的国家/地区值和 6 个年份(从 1980 年到 1985 年)。

|   COL A   |   COL B   |   COL C  |
+-----------+-----------+----------+
     AT     |  Austria  |   1980
     AT     |  Austria  |   1981
     AT     |  Austria  |   1982
     AT     |  Austria  |   1983
     AT     |  Austria  |   1984
     AT     |  Austria  |   1985
     AT     |  Austria  |   1980
     BE     |  Belgium  |   1980
     BE     |  Belgium  |   1981
     BE     |  Belgium  |   1982
     BE     |  Belgium  |   1983
     BE     |  Belgium  |   1984
     BE     |  Belgium  |   1985
    CH07    |  Ticino   |   1980
    CH07    |  Ticino   |   1981
    CH07    |  Ticino   |   1982
    CH07    |  Ticino   |   1983
    CH07    |  Ticino   |   1984
    CH07    |  Ticino   |   1985

我想要的是这个:

|   COL A   |   COL B   |   COL C  |   COL D   |
+-----------+-----------+----------+-----------+
     AT     |  Austria  |   1980   |     A
     AT     |  Austria  |   1981   |     A
     AT     |  Austria  |   1982   |     A
     AT     |  Austria  |   1983   |     A
     AT     |  Austria  |   1984   |     A
     AT     |  Austria  |   1985   |     A
     AT     |  Austria  |   1980   |     B
     AT     |  Austria  |   1981   |     B
     AT     |  Austria  |   1982   |     B
     AT     |  Austria  |   1983   |     B
     AT     |  Austria  |   1984   |     B
     AT     |  Austria  |   1985   |     B
     AT     |  Austria  |   1980   |     C
     AT     |  Austria  |   1981   |     C
     AT     |  Austria  |   1982   |     C
     AT     |  Austria  |   1983   |     C
     AT     |  Austria  |   1984   |     C
     AT     |  Austria  |   1985   |     C
     AT     |  Austria  |   1980   |     D
     AT     |  Austria  |   1981   |     D
     AT     |  Austria  |   1982   |     D
     AT     |  Austria  |   1983   |     D
     AT     |  Austria  |   1984   |     D
     AT     |  Austria  |   1985   |     D
     BE     |  Belgium  |   1980   |     A
     BE     |  Belgium  |   1981   |     A
     BE     |  Belgium  |   1982   |     A
     BE     |  Belgium  |   1983   |     A
     BE     |  Belgium  |   1984   |     A
     BE     |  Belgium  |   1985   |     A
     BE     |  Belgium  |   1980   |     B
     BE     |  Belgium  |   1981   |     B
     BE     |  Belgium  |   1982   |     B
     BE     |  Belgium  |   1983   |     B
     BE     |  Belgium  |   1984   |     B
     BE     |  Belgium  |   1985   |     B
     BE     |  Belgium  |   1980   |     C
     BE     |  Belgium  |   1981   |     C
     BE     |  Belgium  |   1982   |     C
     BE     |  Belgium  |   1983   |     C
     BE     |  Belgium  |   1984   |     C
     BE     |  Belgium  |   1985   |     C
     BE     |  Belgium  |   1980   |     D
     BE     |  Belgium  |   1981   |     D
     BE     |  Belgium  |   1982   |     D
     BE     |  Belgium  |   1983   |     D
     BE     |  Belgium  |   1984   |     D
     BE     |  Belgium  |   1985   |     D
    CH07    |  Ticino   |   1980   |     A
    CH07    |  Ticino   |   1981   |     A
    CH07    |  Ticino   |   1982   |     A
    CH07    |  Ticino   |   1983   |     A
    CH07    |  Ticino   |   1984   |     A
    CH07    |  Ticino   |   1985   |     A
    CH07    |  Ticino   |   1980   |     B
    CH07    |  Ticino   |   1981   |     B
    CH07    |  Ticino   |   1982   |     B
    CH07    |  Ticino   |   1983   |     B
    CH07    |  Ticino   |   1984   |     B
    CH07    |  Ticino   |   1985   |     B
    CH07    |  Ticino   |   1980   |     C
    CH07    |  Ticino   |   1981   |     C
    CH07    |  Ticino   |   1982   |     C
    CH07    |  Ticino   |   1983   |     C
    CH07    |  Ticino   |   1984   |     C
    CH07    |  Ticino   |   1985   |     C
    CH07    |  Ticino   |   1980   |     D
    CH07    |  Ticino   |   1981   |     D
    CH07    |  Ticino   |   1982   |     D
    CH07    |  Ticino   |   1983   |     D
    CH07    |  Ticino   |   1984   |     D
    CH07    |  Ticino   |   1985   |     D

所以我想要的是:

  • 创建新列(D 列)
  • 将每个国家/地区的 6 行复制 5 次(以便 D 列的每个值总共有 6 个值)
  • D 列的值是标准的(在此示例中,它们始终是 A、B、C 和 D)

我该怎么做?手动操作太麻烦,而且容易出错。

不幸的是,用语言很难解释,但我希望这个例子是有帮助的。

谢谢

答案1

尝试这个:

  1. 插入 D 列,在所有 354*37 个单元格中输入值“A”。
  2. 将其复制并粘贴到新工作表中(例如sheet_2
  3. 返回原始页面,将 D 列中的“A”替换为“B”
  4. 将此附加到表中sheet_2
  5. 对剩余的值(示例中的“C”和“D”)重复步骤 3 和 4
  6. 种类sheet_2

相关内容