+ Reply to Thread
Results 1 to 9 of 9

Slightly confusing question on how the find the sum

  1. #1
    Registered User
    Join Date
    06-08-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    9

    Slightly confusing question on how the find the sum

    Is it possible to make excel find the total amount of item in the box from the value we input into a cell, added from box #1 first to box #6? This might be confusing so consider the scenario below:

    box #: 1, 2, 3, 4, 5, 6
    amount of item in box: 1, 2, 4, 8, 12, 16

    Would it be possible to make excel add up the sum from box #1-4 simply by typing 4 or box #1-6 by typing 6 and so on?

    So this should appear:

    value: 1, 4, 6
    total amount of item: 1, 15, 43

    Basically, if the value is 1 then we find the sum of box #1 so its 1, and if the value is 4 then we find the total amount of item from box #1 to box #4, so 1 + 2 + 4 + 8 = 15, and so on.

    How do I do this? What do I write into the excel to make this? Thanks.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Slightly confusing question on how the find the sum

    with those values in a1:f1
    in a2 enter the number you want so sum
    in a3
    =SUM(OFFSET(A1,,,,A2))
    so if a2 contained 5 you would get 27
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    06-08-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Slightly confusing question on how the find the sum

    Thanks for the response but doesn't work. Assuming the values are in a1:f1, when I type in: =SUM(OFFSET(A1:F1,A2)) an error comes up. Could you be more specific, I am a noob when it comes to excel.

  4. #4
    Registered User
    Join Date
    06-08-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Slightly confusing question on how the find the sum

    Ignore the above I misread your post. What do I do if the values are in a1:a6?

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Slightly confusing question on how the find the sum

    =SUM(OFFSET(A1,,,C1)) where c1 contains 1 2 3 4 5 or 6

  6. #6
    Registered User
    Join Date
    06-08-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Slightly confusing question on how the find the sum

    Thanks! But I have another problem, if the value of the height is 0, it comes up as an #REF! error so its there anyway to force this value to 0 when this error shows up? I'm trying to add it with another column but it doesn't work if the first value is an error, if you get what I mean.

    Basically, this is what I'm trying to do: =(SUM(OFFSET($R$35,,,R21,)))+(SUM(OFFSET($S$35,,,S21,)))) but if R21 is 0 then the cell turns up to be an error, even though the second part functions perfectly fine alone.
    Last edited by beamthegreat; 06-08-2013 at 05:20 PM.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Slightly confusing question on how the find the sum

    =iferror(SUM(OFFSET(A1,,,C1)),0)

  8. #8
    Registered User
    Join Date
    06-08-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Slightly confusing question on how the find the sum

    I found a temporary solution. Basically, I added one to the height =(SUM(OFFSET($R$35,,,R21+1,))) and input the value of the first value to 0 lol But if you have a better solution please post it here. It will be greatly appreciated!

  9. #9
    Registered User
    Join Date
    06-08-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    9

    Re: Slightly confusing question on how the find the sum

    Quote Originally Posted by martindwilson View Post
    =iferror(SUM(OFFSET(A1,,,C1)),0)
    Thanks! This is exactly what I needed, I will forever be indebted to you.

+ 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