I am having trouble using INDEX and MATCH functions in excel. Say I have the following data:
A B C D
Year Month Site Count
2004 3 X1 54
2006 6 X3 10
2005 10 X5 15
And I want to arrange it like this
E F G H I J K
Year Month X1 X2 X3 X4 X5
2004 1
2004 2
2004 3 54
2004 4
2004 5
2004 6
...
2005 10 10
...
2006 6 15
I have the following formula (I want to match the Site, Year and Month):
=IFERROR(INDEX($D$2:$D$4,MATCH(G$1,$C$2:$C$4,0),MATCH($E2,$A$2:$A$4,0),MATCH($F2,$B$2:$B$4,0)),"")
and it seems to work fine for the first column (G) but when I autofill the rest of the columns (H:K) it doesn't work. Any ideas? Thanks.