Copy values from specific cells in rows to a colum

2019-07-23 04:21发布

Trying to gain understanding on writing functions in Microsoft Excel. I created a simple example to practice a few simple actions; namely, how to get all values in a specified order from rows (between two given cells and which have a specified range) and copy them on a separate column.

As can be seen on the example below, I have 3 sets of values (ALPHA, BETA and GAMMA), each with numeric values ranging on 4 columns (A, B, C and D) and on 7 rows where on the last row the last column (column D) is empty. Each set of value has a title name residing on column A before each values (i.e. on (A,1), (A,9) and (A, 18)).

          A           B           C           D
1     ALPHA_VALUES              
2     2.93E+02  7.15E+02    1.22E+03    1.27E+03
3     1.84E+03  1.77E+03    1.88E+03    1.97E+03
4     2.10E+03  2.14E+03    2.17E+03    2.18E+03
5     2.10E+03  2.20E+03    2.19E+03    2.18E+03
6     1.33E+03  1.25E+03    1.30E+03    1.13E+03
7     9.83E+02  9.03E+02    8.20E+02    7.32E+02
8     5.37E+02  4.24E+02    2.93E+02        
9     BETA_VALUES               
10    0.00E+00  8.71E-10    2.53E-09    1.50E-08
11    5.20E-07  2.11E-06    6.49E-06    1.61E-05
12    6.38E-05  1.08E-04    1.68E-04    2.43E-04
13    4.32E-04  5.51E-04    7.38E-04    1.00E-03
14    1.88E-03  2.54E-03    3.33E-03    4.27E-03
15    6.06E-03  6.92E-03    7.68E-03    8.31E-03
16    2.67E-03  1.44E-03    0.00E+00        
17    GAMMA_VALUES          
18    0.00E+00  5.85E-14    8.74E-12    1.47E-10
19    1.29E-08  7.45E-08    3.01E-07    9.09E-07
20    4.51E-06  8.04E-06    1.27E-05    5.81E-05
21    2.89E-05  3.46E-05    4.04E-05    4.44E-05
22    3.83E-05  2.69E-05    1.70E-05    1.27E-05
23    7.26E-06  4.85E-06    3.01E-06    1.78E-06
24    6.17E-14  2.22E-15    0.00E+00        

I want to copy each of the 3 sets above on a separate column. For fetching the data on the cells of each row, the order I want the data to be copied to a new separate column if from left to right; i.e. for APLHA_VALUES the resulting column should be like so:

2.93E+02    
7.15E+02
1.22E+03
1.27E+03
1.84E+03
1.77E+03
1.88E+03
1.97E+03
2.10E+03
2.14E+03
2.17E+03
2.18E+03
1.33E+03
1.25E+03
1.30E+03
1.13E+03
9.83E+02
9.03E+02
8.20E+02
7.32E+02
5.37E+02
4.24E+02
2.93E+02    

Any sample code to get me starting on how to fetch and copy the specified data on a column will be much appreciated.

MODIFIED EXAMPLE (to better demonstrate a formula's workings):

~Added a 1 extra column and 3 extra rows for each set. Also added some data on the first 6 lines which do not participate in the formula.

          A           B           C           D           E
1     blah           
2     blah           4124
3     blah           342
4     blah           321
5     blah           43
6     blah 
7     ALPHA_VALUES              
8     2.93E+02  7.15E+02    1.22E+03    1.27E+03    1.27E+03
9     1.84E+03  1.77E+03    1.88E+03    1.97E+03    1.97E+03
10    2.10E+03  2.14E+03    2.17E+03    2.18E+03    1.97E+03
11    2.10E+03  2.20E+03    2.19E+03    2.18E+03    1.97E+03
12    1.33E+03  1.25E+03    1.30E+03    1.13E+03    1.97E+03
13    9.83E+02  9.03E+02    8.20E+02    7.32E+02    1.97E+03
14    2.10E+03  2.20E+03    2.19E+03    2.18E+03    1.97E+03
15    1.33E+03  1.25E+03    1.30E+03    1.13E+03    1.97E+03
16    9.83E+02  9.03E+02    8.20E+02    7.32E+02    1.97E+03    
17    5.37E+02  4.24E+02    2.93E+02        
18    BETA_VALUES               
19    0.00E+00  8.71E-10    2.53E-09    1.50E-08    1.50E-08
20    5.20E-07  2.11E-06    6.49E-06    1.61E-05    1.50E-08
21    6.38E-05  1.08E-04    1.68E-04    2.43E-04    1.50E-08
22    4.32E-04  5.51E-04    7.38E-04    1.00E-03    1.50E-08
23    1.88E-03  2.54E-03    3.33E-03    4.27E-03    1.50E-08
24    6.06E-03  6.92E-03    7.68E-03    8.31E-03    1.50E-08
25    4.32E-04  5.51E-04    7.38E-04    1.00E-03    1.50E-08
26    1.88E-03  2.54E-03    3.33E-03    4.27E-03    1.50E-08
27    6.06E-03  6.92E-03    7.68E-03    8.31E-03    1.50E-08
28    2.67E-03  1.44E-03    0.00E+00        
29    GAMMA_VALUES          
30    0.00E+00  5.85E-14    8.74E-12    1.47E-10    1.47E-10
31    1.29E-08  7.45E-08    3.01E-07    9.09E-07    1.47E-10
32    4.51E-06  8.04E-06    1.27E-05    5.81E-05    1.47E-10
33    2.89E-05  3.46E-05    4.04E-05    4.44E-05    1.47E-10
34    3.83E-05  2.69E-05    1.70E-05    1.27E-05    1.47E-10
35    7.26E-06  4.85E-06    3.01E-06    1.78E-06    1.47E-10
36    2.89E-05  3.46E-05    4.04E-05    4.44E-05    1.47E-10
37    3.83E-05  2.69E-05    1.70E-05    1.27E-05    1.47E-10
38    7.26E-06  4.85E-06    3.01E-06    1.78E-06    1.47E-10
39    6.17E-14  2.22E-15    0.00E+00    

1条回答
可以哭但决不认输i
2楼-- · 2019-07-23 05:04

The formula you are looking for is INDEX:

=INDEX($A:$D,INT((ROW(1:1)-1)/4)+1+MATCH(F$1,$A:$A,0),MOD(ROW(1:1)-1,4)+1)

Put it in F2 copy over two columns and down 27.

enter image description here

查看更多
登录 后发表回答