我有这张桌子:
A B
1 Company Code Year
2 61.490.561/0001-00 2018
3 61.490.561/0001-00 2017
4 61.490.561/0001-00 2016
5 84.586.205/0001-90 2018
6 84.586.205/0001-90 2017
7 84.586.205/0001-90 2016
8 01.009.357/0001-01 2017
9 01.009.357/0001-01 2015
10 01.009.354/0001-60 2017
11 01.009.354/0001-60 2016
12 01.009.355/0001-04 2016
13 01.009.355/0001-04 2015
14 04.185.877/0001-55 2018
15 04.185.877/0001-55 2017
16 04.185.877/0001-55 2016
...
我需要:
在上面的示例中,它看起来像这样:
A B
1 Company Code Year
2 61.490.561/0001-00 2023
3 61.490.561/0001-00 2022
4 61.490.561/0001-00 2021
5 61.490.561/0001-00 2020
6 61.490.561/0001-00 2019
7 84.586.205/0001-90 2023
8 84.586.205/0001-90 2022
9 84.586.205/0001-90 2021
10 84.586.205/0001-90 2020
11 84.586.205/0001-90 2019
12 01.009.357/0001-01 2022
13 01.009.357/0001-01 2021
14 01.009.357/0001-01 2020
15 01.009.357/0001-01 2019
16 01.009.357/0001-01 2018
17 01.009.354/0001-60 2022
18 01.009.354/0001-60 2021
19 01.009.354/0001-60 2020
20 01.009.354/0001-60 2019
21 01.009.354/0001-60 2018
22 01.009.355/0001-04 2021
23 01.009.355/0001-04 2020
24 01.009.355/0001-04 2019
25 01.009.355/0001-04 2018
26 01.009.355/0001-04 2017
27 04.185.877/0001-55 2023
28 04.185.877/0001-55 2022
29 04.185.877/0001-55 2021
30 04.185.877/0001-55 2020
31 04.185.877/0001-55 2019
我尝试使用查询,但是这对于我的技能而言似乎相当高级。我该如何开始呢?
答案 0 :(得分:1)
=ARRAYFORMULA({A1:B1; SORT({
QUERY(UNIQUE(IFERROR(VLOOKUP(INDEX(SORT(A2:B, 1, 1, 2, 0), , 1),
SORT(A2:B, 1, 1, 2, 0), {1, 2}, 0))), "select Col1,Col2+1 label Col2+1''", 0);
QUERY(UNIQUE(IFERROR(VLOOKUP(INDEX(SORT(A2:B, 1, 1, 2, 0), , 1),
SORT(A2:B, 1, 1, 2, 0), {1, 2}, 0))), "select Col1,Col2+2 label Col2+2''", 0);
QUERY(UNIQUE(IFERROR(VLOOKUP(INDEX(SORT(A2:B, 1, 1, 2, 0), , 1),
SORT(A2:B, 1, 1, 2, 0), {1, 2}, 0))), "select Col1,Col2+3 label Col2+3''", 0);
QUERY(UNIQUE(IFERROR(VLOOKUP(INDEX(SORT(A2:B, 1, 1, 2, 0), , 1),
SORT(A2:B, 1, 1, 2, 0), {1, 2} ,0))) ,"select Col1,Col2+4 label Col2+4''", 0);
QUERY(UNIQUE(IFERROR(VLOOKUP(INDEX(SORT(A2:B, 1, 1, 2, 0), , 1),
SORT(A2:B, 1, 1, 2, 0), {1, 2}, 0))), "select Col1,Col2+5 label Col2+5''", 0)},
1, 1, 2, 0)})
答案 1 :(得分:1)