-2

Using Microsoft Excel 2010, I have a spreadsheet containing data from 5 different datafiles (each having 14 columns, so 70 columns together). What I need to do, is to sort these columns in this fashion: 1.,15.,29.,43.,57.,2.,16.,...etc.

Basically, I need first columns from 5 datafiles in a row, then second columns etc. Is there some way in Excel how to write this sequence? I tried substitute, address and indirect, but without any results. I can write it manually, but as I need it with different spreadsheets as well, I thought it might be handy to have an actual command for it.

4

2 回答 2

1

输入1,按住ColumnA拖动到ColumnNCtrl选择所有 14 个单元格并按住鼠标ColumnBR拖动Ctrl1按添加等的行对最小到最大的列进行排序。

于 2013-05-10T13:58:10.763 回答
1

首先在最终电子表格中使用以下公式:

=INDEX({"Sheet1";"Sheet2";"Sheet3";"Sheet4";"Sheet5"},MOD(COLUMN()-1,5)+1)

如果您将此公式粘贴到最终电子表格的每一列上,它将从列循环Sheet1Sheet5从列AE等。您在其中写入文件的名称和电子表格目标,这将作为公式参考的基础。

该公式的工作原理如下:通过对COLUMN索引值应用模数,我们得到从 1 到 5 的数字,用于从常量数组INDEX​​中获取一项。

现在我们通过电子表格获得了循环的基础,我们现在需要一组 5 列 A,然后是 5 列 B,等等。我们使用这个:

=QUOTIENT(COLUMN()-1, 5)+1

现在我们可以将它们与ADDRESS

=ADDRESS(ROW(),QUOTIENT(COLUMN()-1, 5)+1,1,1,INDEX({"Sheet1";"Sheet2";"Sheet3";"Sheet4";"Sheet5"},MOD(COLUMN()-1,5)+1))

如果您在 A1:J3 范围内粘贴并扩展公式,您将获得以下地址:

Sheet1!$A$1 Sheet2!$A$1 Sheet3!$A$1 Sheet4!$A$1 Sheet5!$A$1 Sheet1!$B$1 Sheet2!$B$1 Sheet3!$B$1 Sheet4!$B$1 Sheet5!$B$1
Sheet1!$A$2 Sheet2!$A$2 Sheet3!$A$2 Sheet4!$A$2 Sheet5!$A$2 Sheet1!$B$2 Sheet2!$B$2 Sheet3!$B$2 Sheet4!$B$2 Sheet5!$B$2
Sheet1!$A$3 Sheet2!$A$3 Sheet3!$A$3 Sheet4!$A$3 Sheet5!$A$3 Sheet1!$B$3 Sheet2!$B$3 Sheet3!$B$3 Sheet4!$B$3 Sheet5!$B$3

最终我们用这个公式包装INDIRECT得到实际数据:

=INDIRECT(ADDRESS(ROW(),QUOTIENT(COLUMN()-1, 5)+1,1,1,INDEX({"Sheet1";"Sheet2";"Sheet3";"Sheet4";"Sheet5"},MOD(COLUMN()-1,5)+1)))
于 2013-05-10T13:54:14.207 回答