## 2 Answers

Here we go.

## STEP 1:

Name ranges for convenience. PARAMETERS is the list of parameters from A2 on down; LOCATIONS is the list of locations, from B1 across; DATA is the large square from B2 to the end. See my example:

## STEP 2:

In another sheet, set up your new table.

First column prints out all the locations, and it lists each location as many times as there are parameters:

That formula:

```
=INDEX(LOCATIONS,ROUNDUP((ROW()-1)/COUNTA(PARAMETERS),0))
```

That formula copies down.

## STEP 3:

Second column prints out all the parameters, and it lists each parameter once until there are no more to list (note that this count corresponds to the count of how many times to list each Location in Step 2). Now you’ve got your entire list of every location/parameter combination, once each:

That formula:

```
=INDEX(PARAMETERS,MOD(ROW()-2,COUNTA(PARAMETERS))+1)
```

That formula copies down.

## STEP 4:

From here, the way forward should be clear – we’re now working with a simple INDEX MATCH to find the data at the intersection of the given location and parameter.

That formula:

```
=INDEX(DATA,MATCH(B2,PARAMETERS,0),MATCH(A2,LOCATIONS,0))
```

That formula copies down.

## CONCLUSION:

With three formulas you’ve created your join table. Please consider selecting this answer so this question can be removed from the unanswered queue.

## NOTES:

- This works dynamically no matter how many columns/rows you have in your data (as long as you adjust the named ranges as needed, if you add more than the 365*768 records in this question’s spec).
- It doesn’t do anything special with missing or empty data, though; you could easily wrap the final INDEX MATCH in Step 4 with an IF(ISBLANK()) to return something more useful than ‘0’.
- This is NOT designed to skip those records, which adds a layer of complexity that’s outside the scope of this question.

Try this in the result column:

```
=OFFSET($A$1,MATCH(B7,$A$2:$A$4),MATCH(A7,$B$1:$E$1))
```

4

3