Sorting three columns into six, sorted horizontall

2019-09-09 09:39发布

I work at an event centre with a portrait screen either side of the entrance doors that we like to list peoples names and table numbers. We often get the list in the format;

Surname  | First Name | Table Number
======================================
Aadomson |    Adam    |      5
Bobson   |    Bob     |      10

etc

What we'd love to do is take those three columns and get a script or something (we're a little over our heads) or be pointed in the right direction for something that could sort it to two or three sets of columns (2 lots of surname, first name and table)

To something that goes like

Surname  | First Name | Table |  Surname  | First Name | Table
===============================================================
Aadamson |    Adam    |   5   |  Bobson   |     Bob    |  30
Christon |    Chris   |   8   | Donaldson |    Donald  |  40

etc

If anyone could shed any help that would be incredible!

1条回答
冷血范
2楼-- · 2019-09-09 10:14

Check this and this for a hint on how to use INDEX.

I will use the more general answer here with OFFSET (item 8).

Assuming:

  • Your source data lays in A2:C3 (you can extend this range as needed),
  • Cell D2 contains 3 (your source width)
  • Cell D3 contains 2 (the number of repeats)
  • Your target range starts at F2

then cell F2: =OFFSET($A$2,(ROW()-ROW($F$2))*$D$3+INT((COLUMN()-COLUMN($F$2))/$D$2),MOD((COLUMN()-COLUMN($F$2)),$D$2))

Copy this to the right (6 columns) and down as far as needed.

查看更多
登录 后发表回答