add rows with column greater than 3

Dear expert.

The number 1 below is in cell A1 and the number 10 is in cell B1.
I will enter in cell C1 a value from 1 to 6 and in cell D1 there should be a formula that adds rows 1 until the value inputed in C1. The formula sould look at column A and see if the value is less than or equal to value in C1, if so then it should add value in B1, this process should continue for range A1:B6.

Another way, is to have B1 as starting celll, and in C1 enter how many rows down we want sum. Example, if C1 reads 4 then it would sum B1:B4.


1      10
2      22
3      33
4      44
5      55
6      66
7      77
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this formula in D1:


easycapitalAuthor Commented:
If C1 = 3 then D1 should = 10 + 22 + 33
easycapitalAuthor Commented:
If C1 = 5 then D1 should = 10 + 22 + 33 + 44 + 55.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Here it is for column B:

For the equal to or less that part, try this:

Glenn RayExcel VBA DeveloperCommented:
To get the nth sum of values in column B add this formula to cell D1:
=SUM(INDIRECT("B1:B" & $C$1))

This is a variation of Flyster's post above in 40420705.

Glenn RayExcel VBA DeveloperCommented:
Or, if you wanted to avoid using an INDIRECT function, use this array formula:

This has to be entered with [Ctrl]+[Shift]+[Enter].
easycapitalAuthor Commented:
is there a possibility to the use the SUMIF function?
Yes, my sample above is one. This one is for numbers in column A that are less or equal to column C:


In case you're wondering, the Indirect function allows you to use a cell value as a reference.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
easycapitalAuthor Commented:
Will need to check again. I will revert.
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.