excelproblems34212
excelproblems34212

Reputation: 13

Excel | Formula to find total amount in this situation

Assume that we are currently in the month March. I have a table with all the months and a list of products. Inside each column i have the number sales a product has made on that month, like so: enter image description here

Notice i have a cell containing "Total until current month". I would require a formula to find out the total amount of sales of a specific product (product A for example) up until March (current month) as you can see with the manually typed 6, 1 in Jan and 5 in Feb.

I would usually do this by finding the sum of cell C4 and D5. But this should be 1 dynamic formula that is updating as we progress onto next month. So as an exammple, in April, it will find the sum of cell C4 - E5 (Jan - March) and update the value.

Is this possible?

Regards

Upvotes: 1

Views: 212

Answers (3)

zaptask
zaptask

Reputation: 707

In row 3 put month numbers. Now if in cell Q4 you have a month number that you want to relate to use:

=SUMIF($C$3:$N$3,"<"&$Q$4,C5:N5)

for sum of A and drag down for other products.

If you want to pick the product you want sum for and have it all in one cell, then assuming that in cell R4 you have your product name (e.g. "B") write

=SUM((C3:N3<Q4)*C5:N6*(B5:B6=R4))

and press ctrl+shift+enter.

Upvotes: 1

Scott Craner
Scott Craner

Reputation: 152465

Put a helper row above the month names that has the month numbers 1-12.

Then use SUMIFS():

=SUMIF($C$2:$N$2,"<=" &MONTH(TODAY()),C4:N4)

enter image description here

You could hide that row so it is not visible and not readily accessible.

Upvotes: 1

Gary&#39;s Student
Gary&#39;s Student

Reputation: 96753

The simplest solution is to leave E4 through N4 empty. Only put a value in E4 once March is complete and you have a value for March. This will allow a formula like:

=SUM(C4:N4)

for Product A

Upvotes: 0

Related Questions