Automatically Add Values in Excel Based on the Previous Row
Question details
The user needs to populate column B with a running total based on values entered in column A.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Values are entered in column A, and each corresponding cell in column B should add that value to the previous result in column B.
- Observed behavior
- Unused rows in column B should remain blank, while rows with values in column A should display the accumulated total.
Confirm that the running total begins in row 2 and that column B row 1 contains the starting value or total. Decide how far down column B the formula should be filled, such as through row 1000.
Use an IF and SUM formula for a running total
Use this formula when column B should stay blank until a value is entered in the matching cell in column A.
The IF function checks whether the current cell in column A is empty. If it is not empty, SUM adds that value to the previous result in column B.
Open the worksheet and select cell B2, or the first cell in column B that should calculate a result.
Type =IF(A2="","",SUM(B1,A2)) in the formula bar or directly in cell B2, then press Enter.
Select B2, drag its fill handle downward, or copy and paste it through the required range, such as B2:B1000.
Enter a number in A2 and confirm that B2 adds it to B1. Leave another cell in column A empty to verify that its corresponding column B cell remains blank.

Create a running total in WPS Spreadsheet with a blank-row formula
WPS Spreadsheet can use the same IF and SUM formula to build a running total in column B. Enter the formula in the first result cell, then fill it down to calculate only rows with values in column A.
- 1. Open the spreadsheet: Launch WPS Spreadsheet and open the workbook containing columns A and B.
- 2. Enter the formula: Select B2 and enter =IF(A2="","",SUM(B1,A2)), then press Enter.
- 3. Fill the formula down: Copy B2 or drag its fill handle down the required range in column B.
- 4. Verify the running total: Enter values in column A and check that each corresponding cell in column B adds the new value to the previous result.

Frequently Asked Questions
Why does the formula use IF before SUM?
IF checks whether the matching cell in column A is empty. When it is empty, the formula returns ""; otherwise, SUM adds the value in A to the previous result in column B.
Where should I enter the first formula?
Enter =IF(A2="","",SUM(B1,A2)) in B2 when row 1 contains the starting value or total. Adjust the row references if your data starts on a different row.
How can I apply the formula to many rows?
Select B2 and drag the fill handle down, or copy B2 and paste it into the required range, such as B2:B1000. The row references adjust automatically.
What happens if a value is deleted from column A?
The corresponding cell in column B becomes blank, but later running totals recalculate based on the updated preceding values when the formula is filled down.




