I have no idea where to start with this problem (may be due to poor knowledge of terminology). I have two worksheets which I will put up in Google Sheets which I'd like to generate a third worksheet for (also in the same Google Sheets file).

https://docs.google.com/spreadsheets/d/1ALQlQhNugUnQzM5NdbFsLX_TlhV6BzT_1TDQKc6hD5I/edit?usp=sharing

I'd like to have information from the Budgeting Groups worksheet be displayed downwards in the Balance worksheet for each company along with their company code in the Company worksheet. Would it be best to write a macro for this interaction or is it possible to do it with formulas? Thanks in advance! Let me know if I wasn't clear.

EDIT: To make it clearer, I'm trying to generate the Balance worksheet from scratch based on information in the Budgeting Groups and Companies worksheet.

# Best How To :

I found a solution by Spioter at Excel vba to create every possible combination of a Range which proved immensely helpful! Modified the script to fit my needs and sheet which does not reflect the Google Sheet link in the question. Thank you Spioter!

```
Sub sub_CrossJoin()
Worksheets("Combinations").Range("A4:B2000").ClearContents
Dim rg_Legend As Range
Dim rg_Implementers As Range
Dim rg_RowLegend As Range
Dim rg_RowImplementers As Range
Dim rg_DestinationCol As Range
Dim rg_DestinationCell As Range
Dim int_PriorCombos As Long
Dim int_TotalCombos As Long
Dim int_LegendRowCount As Long
Dim int_ImplementersRowCount As Long
Dim int_ValueRepeats As Long
Dim int_ValueRepeater As Long
Dim int_ValueCycles As Long
Dim int_ValueCycler As Long
int_TotalCombos = 1
int_PriorCombos = 1
int_ValueRowCount = 0
int_ValueCycler = 0
int_ValueRepeater = 0
Set rg_Legend = Worksheets("Legend").Range("A8:A500")
Set rg_Implementers = Worksheets("Implementers").Range("A3:A50")
Set rg_DestinationCol = Worksheets("Combinations").Range("A4")
'Get total combos
int_LegendRowCount = 0
For Each rg_RowLegend In rg_Legend.Cells
If rg_RowLegend.Value = "" Then
Exit For
End If
int_LegendRowCount = int_LegendRowCount + 1
Next rg_RowLegend
int_TotalCombos = int_TotalCombos * int_LegendRowCount
int_ImplementersRowCount = 0
For Each rg_RowImplementers In rg_Implementers.Cells
If rg_RowImplementers.Value = "" Then
Exit For
End If
int_ImplementersRowCount = int_ImplementersRowCount + 1
Next rg_RowImplementers
int_TotalCombos = int_TotalCombos * int_ImplementersRowCount
int_LegendRowCount = 0
int_ImplementersRowCount = 0
'Calculate the repeats needed for each row value and then populate the destination
int_LegendRowCount = 0
For Each rg_RowLegend In rg_Legend.Cells
If rg_RowLegend.Value = "" Then
Exit For
End If
int_LegendRowCount = int_LegendRowCount + 1
Next rg_RowLegend
int_PriorCombos = int_PriorCombos * int_LegendRowCount
int_ValueRepeats = int_TotalCombos / int_PriorCombos
int_ValueCycles = (int_TotalCombos / int_ValueRepeats) / int_LegendRowCount
int_ValueCycler = 0
int_ValueRepeater = 0
Set rg_DestinationCell = rg_DestinationCol
For int_ValueCycler = 1 To int_ValueCycles
For Each rg_RowLegend In rg_Legend.Cells
If rg_RowLegend.Value = "" Then
Exit For
End If
For int_ValueRepeater = 1 To int_ValueRepeats
rg_DestinationCell.Value = rg_RowLegend.Value
Set rg_DestinationCell = rg_DestinationCell.Offset(1, 0)
Next int_ValueRepeater
Next rg_RowLegend
Next int_ValueCycler
Set rg_DestinationCol = rg_DestinationCol.Offset(0, 1)
For Each rg_RowImplementers In rg_Implementers.Cells
If rg_RowImplementers.Value = "" Then
Exit For
End If
int_ImplementersRowCount = int_ImplementersRowCount + 1
Next rg_RowImplementers
int_PriorCombos = int_PriorCombos * int_ImplementersRowCount
int_ValueRepeats = int_TotalCombos / int_PriorCombos
int_ValueCycles = (int_TotalCombos / int_ValueRepeats) / int_ImplementersRowCount
int_ValueCycler = 0
int_ValueRepeater = 0
Set rg_DestinationCell = rg_DestinationCol
For int_ValueCycler = 1 To int_ValueCycles
For Each rg_RowImplementers In rg_Implementers.Cells
If rg_RowImplementers.Value = "" Then
Exit For
End If
For int_ValueRepeater = 1 To int_ValueRepeats
rg_DestinationCell.Value = rg_RowImplementers.Value
Set rg_DestinationCell = rg_DestinationCell.Offset(1, 0)
Next int_ValueRepeater
Next rg_RowImplementers
Next int_ValueCycler
Set rg_DestinationCol = rg_DestinationCol.Offset(0, 1)
End Sub
```