## You are learning SUM in MS Excel

Adding visible cells only with SUM?

There are two main ways to achieve "Adding visible cells only with SUM" in Excel:

1. Using the SUBTOTAL Function:

The SUBTOTAL function is specifically designed to perform calculations on visible data even when filters are applied. Here's how to use it:

- In the cell where you want the sum of visible cells, enter the formula:

`=SUBTOTAL(109, range)`

- Replace `range` with the actual cell range you want to sum. For example, if your data is in cells A1:A20, the formula would be:

`=SUBTOTAL(109, A1:A20)`

- The number `109` within the SUBTOTAL function tells Excel to use the SUM operation while ignoring hidden rows (achieved through the additional 1 in the code).

2. Using the SUM function with a helper column (Optional):

This method involves creating a helper column to identify visible rows and then using SUM to calculate the total only for those rows.

- In a new column (let's say column B), enter the formula `=IF(A1<>"", 1, 0)` in cell B1 (assuming your data is in column A). This formula checks if the corresponding cell in column A is empty (""). If not, it enters 1, indicating a visible row. Otherwise, it enters 0. Drag this formula down to fill the entire range corresponding to your data.

- In the cell where you want the sum of visible cells, enter the formula:

`=SUM(B1:B20)` (assuming your data goes from A1:A20 and the helper column is B)

- This formula uses SUM to add the values in the helper column (B), which will only include 1s for visible rows, effectively summing the visible cells in column A.

Choosing the Right Method:

- If you frequently use filters and want an automatic solution that adapts to them, SUBTOTAL is a good option.

- If you prefer a more manual approach or need the helper column for other purposes, the SUM with a helper column method can be useful.