Share via

Excel - Return cell data with multiple variables

Anonymous
2024-07-16T14:45:12+00:00

I was given a spreadsheet that I need to reformat. I'm hoping there's a formula (INDEX + MATCH? HLOOKUP? XLOOKUP?) to make this simpler, but I can't figure out what it would be.

The source document has most of the variables in rows 1 and 2, with one variable in column A. I need to reformat it so that row 1 also becomes a column. Here's some screenshot examples with made-up information:

Source Document looks like this (with actual data in all the cells, I left them blank in my example)

I need the countries to be in a column and the years as only three columns, like this

Is there a way to do this? Transposing the data doesn't give me the results I want, so I think it needs to be a combination of some form of INDEX and MATCH with multiple variables. Any ideas are greatly appreciated!

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2024-07-16T15:26:16+00:00

This one? Could you share some test data on it and show an expected result.

=SUM((Sheet1!$B$1:$G$1=$B11)*(Sheet1!$A$3:$A$5=$A11)*(Sheet1!$B$2:$G$2=C$10)*(Sheet1!$B$3:$G$5))

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2024-07-16T15:34:18+00:00

    Alternatively:

    In C10: =B2

    Fill to the right to E10.

    In A11: =INDEX(A:A, MOD(ROW()-2, 3)+3)

    In B11: =INDEX($1:$1, ROW()-9)

    Fill both down as far as needed.

    In C11: =INDEX($1:$5, MOD(ROW()-2, 3)+3, 3*QUOTIENT(ROW()-2, 3)+COLUMN()-10)

    Fill to the right to E11, then down as far as needed.

    Was this answer helpful?

    0 comments No comments