Multiplication grid?

BuffaloGuy

New Member
Joined
Dec 5, 2017
Messages
31
Office Version
  1. 365
Platform
  1. Windows
I don’t know how to phrase this question, but what is a fast way to keep a constant at the top of a table, multiply down the table, then slide the column to the right, only changing the constant at the top? It is made more complicated with thousands of rows and dozens of columns where the $ is more difficult to use.
My equation is complex than below, but that is the gist.
ABCZ
1A1B1C1Z1
2A2B2C2Z2
3A3B3C3Z3
400A400B400C400Z400
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Which version of Excel are you using?
Show the current formula being used.
 
Upvote 0
Here is a VBA macro approach :

VBA Code:
Option Explicit

Sub CreateLetterNumberMatrix()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim lastCol As Long
    Dim i As Long, j As Long

    ' Set the worksheet to work on
    Set ws = ThisWorkbook.Sheets(1) ' Adjust the sheet index or name as needed

    ' Find the last row in column A and last column in row 1
    lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
    lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column

    ' Loop through the numbers in column A
    For i = 2 To lastRow
        ' Loop through the letters in the first row starting from column B
        For j = 2 To lastCol
            ' Combine the letter in the first row with the number in column A
            ws.Cells(i, j).Value = ws.Cells(1, j).Value & ws.Cells(i, 1).Value
        Next j
    Next i

    MsgBox "Matrix created successfully!"
End Sub
 
Upvote 0
For 365version, In B2
Excel Formula:
=LET(a,B1:E1,b,A2:A5,MAKEARRAY(ROWS(b),COLUMNS(a),LAMBDA(ro,cl,INDEX(a,cl)*INDEX(b,ro))))
For other versions, In B2 copied to full range
Excel Formula:
=$A2*B$1
 
Upvote 0

Forum statistics

Threads
1,225,211
Messages
6,183,614
Members
453,175
Latest member
hagazissa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top