Excel formulas are used to perform calculations automatically. When the same formula-related task is performed repeatedly, you can use the Macro Recorder to record the actions and repeat them automatically.
A formula is an expression used in Excel to perform a calculation.
For example:
=A1+B1
This formula adds the values stored in cells A1 and B1.
Sometimes the same formula needs to be entered repeatedly in different worksheets or reports.
Instead of performing the same actions manually, a macro can record the process and repeat it.
Suppose a student marksheet contains marks in columns B, C, D, E and F. You want to calculate the total in column G.
=SUM(B2:F2)
If many reports use the same calculation, recording a macro can help automate the process.
Create sample student marks in Excel:
A B C D E F
Name Hindi English Math Science Computer
Rahul 70 75 80 72 85
Amit 65 70 76 68 74
You can use this data to practice recording a formula macro.
The Macro Recorder is available from the Developer tab.
Click Developer on the Excel Ribbon.
If the Developer tab is not visible, enable it from Excel Options.
Click:
Developer → Record Macro
Enter a meaningful name such as:
CalculateTotal
Click OK to start recording.
After recording starts, select the cell where you want the result.
For example, select G2 and enter:
=SUM(B2:F2)
Press Enter.
This formula calculates the total marks of the first student.
After entering the formula, you can copy it to another row.
For example, copy the formula from G2 to G3.
G2 → Copy → G3 → Paste
The recorded macro can include these actions.
When you copy a formula, Excel normally adjusts relative cell references.
For example:
G2: =SUM(B2:F2)
Copied to G3:
G3: =SUM(B3:F3)
This behavior is important when working with formulas in multiple rows.
Instead of copying and pasting manually, you can use Excel's fill handle to copy a formula down a column.
For example, drag the formula from G2 down to G10.
The recorded actions can become part of the macro.
A macro can also record the process of entering a percentage formula.
For example, if the total marks are in G2 and the maximum marks are 500:
=G2/500*100
This calculates the student's percentage.
You can record a macro that enters an average formula.
For example:
=AVERAGE(B2:F2)
This calculates the average of the five subject marks.
The MAX function returns the largest value from a range.
Example:
=MAX(B2:F2)
A macro can record the process of entering and copying this formula.
The MIN function returns the smallest value from a range.
Example:
=MIN(B2:F2)
This can also be included in a recorded formula workflow.
A single macro can record multiple formula-related actions.
For example, you can calculate:
All of these actions can be recorded during one macro session.
After completing the formula operations, stop the Macro Recorder.
Developer → Stop Recording
The formula actions are now stored in the macro.
To run the recorded macro:
Developer → Macros
Select the formula macro and click Run.
Excel will repeat the recorded formula-related actions.
The Macro Recorder creates VBA code for the actions you perform.
Open the VBA Editor using:
Developer → Visual Basic
Then open the module containing your recorded macro.
A recorded formula operation may create code similar to:
Range("G2").Select
ActiveCell.Formula = "=SUM(B2:F2)"
The exact generated code can vary depending on how the formula was entered and recorded.
One common formula task is copying a formula down many rows.
For example:
G2 = SUM(B2:F2)
G3 = SUM(B3:F3)
G4 = SUM(B4:F4)
G5 = SUM(B5:F5)
A recorded macro can automate the repeated copy operation.
Formula macros are useful when creating student marksheets.
A macro can help automate calculations such as:
This can reduce repetitive calculation work.
Formula macros can also be useful for preparing reports.
For example, a monthly report may require totals, averages, or percentages to be calculated repeatedly.
A macro can record these repeated actions.
A recorded formula macro generally records the specific cells and actions used during recording.
If the worksheet structure changes significantly, the recorded macro may not work as expected.
For more flexible calculations, VBA programming can be used.
When the number of rows changes regularly, a fixed recorded range may not always be suitable.
For example, today's data may contain 20 students while tomorrow's data may contain 50 students.
VBA can later be used to identify the changing data range automatically.
Suppose marks are stored in B2:F10. You want to calculate totals in column G and percentages in column H.
Total:
=SUM(B2:F2)
Percentage:
=G2/500*100
You can record the process of entering and copying these formulas.
While recording formula macros:
A basic workflow is:
Prepare Data
↓
Developer Tab
↓
Record Macro
↓
Enter Formula
↓
Copy Formula
↓
Perform Calculations
↓
Stop Recording
↓
Run Macro
The Macro Recorder is useful for simple and repetitive formula tasks.
VBA becomes more useful when you need conditions, loops, dynamic ranges, variables, or more complex calculations.
Learning recorded formula macros gives beginners practical experience before moving to advanced VBA programming.
Try this exercise:
A formula macro records repetitive formula-related actions in Excel. It can help enter formulas, copy formulas, and repeat calculation steps.
The Macro Recorder is a simple way for beginners to understand how Excel automation can work. Later, VBA can be used to create more flexible and dynamic formula automation.
Formula → Record → Repeat → Automate
Question: Which formula is commonly used to calculate the total of cells B2 to F2?