Original post: http://community.csdn.net/Expert/topic/5000/5000593.xml
Q: taoyb (tyb)
If a wage data table is printed, A4 paper is used. The header must be added to each row of data, such as employee ID, name, and salary.
This information is available in the first line. How can we put the information in the first line on each line?
A:Yiqun_zhao (lanfan Yu Xuan yiqun.zhao.msmvp@gmail.com)
Assume that the row of the original salary title is in the first row and starts from the second row as data, as shown in the following example:
A B C
1 employee's attendance salary
2 1 21 8430
3 2 21 4690
4 3 20 7545
5 4 21 6680
6 5 21 2190
Assume that our formula starts from D1 (the formula for E1 and F1 is the same, and can be copied from D1). The formula is as follows:
= Indirect (if (mod (row (), 2) = 1, address (mod (row (), 2), column ()-3), address (row () /2 + 1, column ()-3 )))
You can copy the formula to the corresponding area of columns D, E, and F. The result is as follows:
A B C D E F
1. employee ID: Attendance salary
2 1 21 8430 1 21 8430
3 2 21 4690 employee ID attendance salary
4 3 20 7545 2 21 4690
5 4 21 6680 employee ID attendance salary
6 5 21 2190 3 20 7545
Employee ID attendance salary
4 21 6680
Employee ID attendance salary
5 21 2190
You can see that columns D, E, and F have been generated based on the source data of columns A, B, and C.
Note: column ()-3 in the formula indicates the relative position to the right of the three columns. You need to change the corresponding relative position as the worksheet/relative position is different.