Reputation: 481
I have the following table:
A B C
1 1 4 =(Formula)
2 1
3 3
4 4
5 4
I need to get the address of the first occurrence of the value in B1 (4 in this case) from column A (which is A4) and use that address in a formula (located say in C1). The formula should basically do the following:
All three steps should be performed in one single formula.
Upvotes: 0
Views: 3588
Reputation:
While INDEX is the better choice, OFFSET should at least be mentioned.
'A4:A24
=offset(a1, match(b1, a:a, 0)-1, 0, 21, 1)
=sum(offset(a1, match(b1, a:a, 0)-1, 0, 21, 1))
'D4:D24
=offset(a1, match(b1, a:a, 0)-1, 3, 21, 1)
=sum(offset(a1, match(b1, a:a, 0)-1, 3, 21, 1))
Upvotes: 3
Reputation: 152595
Use INDEX/MATCH and INDEX/MATCH+20:
INDEX(A:A,MATCH(B1,A:A,0)):INDEX(A:A,MATCH(B1,A:A,0)+20)
So if we wanted to sum that range:
=SUM(INDEX(A:A,MATCH(B1,A:A,0)):INDEX(A:A,MATCH(B1,A:A,0)+20))
Upvotes: 5