+ Reply to Thread
Results 1 to 6 of 6

need calculation to add sums starting one less than starting number

Hybrid View

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    TEXAS, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    need calculation to add sums starting one less than starting number

    I am trying to find a formula that will automatically add the sum.

    For example let's say I start with 10. I want to start one number below 10 & add them all up. For example, if starting number is 10 then I would take: 9+8+7+6+5+4+3+2+1. I need to be able to do this for any starting number.

    If I start at 100 it would be 99+98+97+96+96+94 all the way down to zero. If starting at 56, I would need to start adding 55+54+53+52+51+50 all the way to zero.

    Do you know a formula I can use? The starting number can be any number, but I need to start one number below the starting numbers and add each following number.
    Last edited by LANB5669; 09-27-2012 at 04:44 PM. Reason: NEED TO EDIT QUESTION

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,677

    Re: formula

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    Audere est facere

  3. #3
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: need calculation to add sums starting one less than starting number

    LANB5669,

    There isn't (that I'm aware of) a specific function or formula that will do what you are asking for. However, Excel is a very flexible, powerful tool, and with a little imagination/creativity, by combining a few functions it can handle a huge range of things.

    So in plain English, you want to be able to input a number, and have Excel subtract 1 from that number, then subtract one from each resulting number until you reach zero, then add those numbers.

    The attached spreadsheet asks the user for a numerical input in A2. B2 then subtracts 1 from the number in A2, provided A2 is greater than zero, with:

    =IF(A2="","",IF(A2>0,A2-1,""))

    B3 subtracts 1 from B2, provided B2 is greater than 0..... and so on, all the way to the bottom of the sheet. (If your number is bigger than 1048575, you'll need a little workaround, which just involves the help of an extra column.)

    C2 simply SUMS the values in Column B.


    EDIT: I have deleted the formula after B300, as having it run to the end of the sheet meant the file was too big to upload. If need be, copy the formula down yourself
    Attached Files Attached Files
    Brendan.


    __________________________________________________________________________________________________
    Things to consider:

    1) You can thank any poster by clicking the * at the left of a helpful post.
    2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
    3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: need calculation to add sums starting one less than starting number

    an alternate method, assuming your number is in A2, use...=A2*(A2-1)/2. using this formula, you wont need a helper column, it will all be done in a single cell, for any value you choose
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: need calculation to add sums starting one less than starting number

    "For people who know their maths"! That's lovely, FDibbins - thanks for sharing.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: need calculation to add sums starting one less than starting number

    you'r welcome, and thx for the star

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1