+ Reply to Thread
Results 1 to 17 of 17

Specific cell value should sum specific cells

  1. #1
    Registered User
    Join Date
    06-30-2017
    Location
    cyprus
    MS-Off Ver
    2013
    Posts
    6

    Question Specific cell value should sum specific cells

    Hi,
    Newbie here. I tried looking in the forum for answers, but couldn't specify my problem in search terms. So any help would be greatly appreciated.

    I have a table which outputs net profit on a yearly basis for 25 years.
    thread1.JPG

    Also on a different worksheet, I have the input cells.

    This cell (A10) will contain either of the following values in either a list or manual input: 10, 15, 20, 25 (years).

    My query is:
    When the user inputs 10 in the first sheet in cell A10,
    another cell, B10 should output the sum of 10 cells from sheet NET PROFIT (G13:P13).
    But when the user inputs 15 in the same cell (A10), B10 should output the sum of 15 horizontal cells in sheet NET PROFIT (G13:U13). Same for 20 and 25.

    Therefore, depending on the value of A10, B10 should calculate the same amount of cells from another sheet and output their sum.

    I apologize if I didn't use correct terminology, I usually use excel for much simpler tasks.

    Appreciate any help!

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,940

    Re: Specific cell value should sum specific cells

    pls attach a sample excel file with desired result
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Specific cell value should sum specific cells

    try
    B10: =SUM('net profit'!G13:OFFSET('net profit'!G13,13,A10))
    max value for A10 is 15 (with your description)


    If that takes care of your original question, please click on Add Reputtion (bottom left corner of the post of the person(s) who helped you)
    then select Thread Tools from the menu (top right corner of your thread) and mark this thread as SOLVED. Thanks.
    Last edited by sandy666; 06-30-2017 at 06:25 AM.

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: Specific cell value should sum specific cells

    Quote Originally Posted by sandy666 View Post
    try
    B10: =SUM('net profit'!G13:OFFSET('net profit'!G13,13,A10))
    max value for A10 is 15 (with your description)


    If that takes care of your original question, please click on Add Reputtion (bottom left corner of the post of the person(s) who helped you)
    then select Thread Tools from the menu (top right corner of your thread) and mark this thread as SOLVED. Thanks.
    I think this is adding one column too many

    Perhaps
    B10: =SUM('net profit'!G13:OFFSET('net profit'!G13,13,A10-1))
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Specific cell value should sum specific cells

    why?
    =COLUMNS(G13:U13) = 15
    ups, you are right

    should be something like this:
    B10: =SUM('net profit'!G13:OFFSET('net profit'!G13,13,A10-1))
    and A10 cannot be 0
    Last edited by sandy666; 06-30-2017 at 06:33 AM.

  6. #6
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: Specific cell value should sum specific cells

    Start with a blank sheet

    put 5 in A10
    in B10 =SUM(G13:OFFSET(G13,13,A10))
    put the numbers 1-10 in G13: P13

    Result is 21

    Thats the numbers 1-6 summed but the value in A is only 5 numbers
    Amend A10 to 1
    Result is 3

    Its adding one column too many

  7. #7
    Registered User
    Join Date
    06-30-2017
    Location
    cyprus
    MS-Off Ver
    2013
    Posts
    6

    Re: Specific cell value should sum specific cells

    hey Guys! Thanks for the quick replies!

    I am attaching a sample file, It is pasted exactly from the actual file therefore the cells are identical. (But not identical to the example I gave above).

    So in the file, CELL E11 is the cell where a user will input the years of agreement: 5,10,15,20,25.
    Cell H15 should calculate the number of cells in sheet DATA, starting G13 up to AE13.

    Relevant example --> User inputs 10 in CELL E11 in sheet PROJECT REPORT, H15 shows SUM of (G13:P13) which means it counted 10 cells.
    if User inputs 15 in CELL E11 in sheet PROJECT REPORT, H15 shows SUM of (G13:U13) which means it counted 10 cells and summed.

    I hope this is a bit clearer now?
    Attached Files Attached Files

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Specific cell value should sum specific cells

    Quote Originally Posted by gregoremm View Post
    cell, B10 should output the sum of 10 cells from sheet NET PROFIT (G13:P13).
    But when the user inputs 15 in the same cell (A10), B10 should output the sum of 15 horizontal cells in sheet NET PROFIT (G13:U13).
    and so on...
    @Special-K
    I changed formula before refresh thread and repeat your correction

  9. #9
    Registered User
    Join Date
    06-30-2017
    Location
    cyprus
    MS-Off Ver
    2013
    Posts
    6

    Re: Specific cell value should sum specific cells

    Quote Originally Posted by Special-K View Post
    Start with a blank sheet

    put 5 in A10
    in B10 =SUM(G13:OFFSET(G13,13,A10))
    put the numbers 1-10 in G13: P13

    Result is 21

    Thats the numbers 1-6 summed but the value in A is only 5 numbers
    Amend A10 to 1
    Result is 3

    Its adding one column too many
    This is perfect!
    Exactly what I want however the rows G13:U13 are in a different sheet. (See attached file)
    How can I refer to it in your formula?

  10. #10
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Specific cell value should sum specific cells

    like this:
    =SUM(DATA!G13:OFFSET(DATA!G13,13,'PROJECT REPORT'!E11-1)) ?

  11. #11
    Registered User
    Join Date
    06-30-2017
    Location
    cyprus
    MS-Off Ver
    2013
    Posts
    6

    Re: Specific cell value should sum specific cells

    Quote Originally Posted by sandy666 View Post
    like this:
    =SUM(DATA!G13:OFFSET(DATA!G13,13,'PROJECT REPORT'!E11-1)) ?
    Perfect!

    I know my questions sound very noob.
    You both solved perfectly.
    Appreciate it!

  12. #12
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Specific cell value should sum specific cells

    You are welcome

    If that takes care of your original question, please click on Add Reputtion (bottom left corner of the post of the person(s) who helped you) then select Thread Tools from the menu (top right corner of your thread) and mark this thread as SOLVED. Thanks.

    I got info from your file:

    error.jpg

    and your G13 value is a text so it will not be summed.
    try this to check: =CELL("type",G13). If result is different than v you need to check format of this cell
    Last edited by sandy666; 06-30-2017 at 07:06 AM.

  13. #13
    Registered User
    Join Date
    06-30-2017
    Location
    cyprus
    MS-Off Ver
    2013
    Posts
    6

    Re: Specific cell value should sum specific cells

    You're right value isn't correct.
    I'm just going to upload the whole file, mind taking a look?
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,078

    Re: Specific cell value should sum specific cells

    Try (am just guessing here)

    =SUM(DATA!G13:OFFSET(DATA!G13,13,D11-1))

  15. #15
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Specific cell value should sum specific cells

    try this one
    =IF('PROJECT REPORT'!$D$11=0,0,SUM(DATA!$G$13:OFFSET(DATA!$G$13,0,'PROJECT REPORT'!$D$11-1,,)))
    Attached Files Attached Files
    Last edited by sandy666; 06-30-2017 at 07:44 AM.

  16. #16
    Registered User
    Join Date
    06-30-2017
    Location
    cyprus
    MS-Off Ver
    2013
    Posts
    6

    Re: Specific cell value should sum specific cells

    Masterpiece

    That "-1" at the end saved it.

  17. #17
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Specific cell value should sum specific cells

    these three things rather
    =IF('PROJECT REPORT'!$D$11=0,0,SUM(DATA!$G$13:OFFSET(DATA!$G$13,0,'PROJECT REPORT'!$D$11-1,,)))

    My fault, I was like a horse with flip-flops on my eyes
    Last edited by sandy666; 06-30-2017 at 07:56 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Counting cells with specific text excluding if date in specific cells
    By FraserMc97 in forum Excel General
    Replies: 2
    Last Post: 04-07-2017, 06:19 AM
  2. VBA MAcro to clear contents of specific cells if a specific cell contains text
    By muzzareilly in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2017, 12:47 PM
  3. [SOLVED] Excel VBA If a cell contains a specific text then other cells will show specific vaules
    By elleb in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-23-2017, 05:14 PM
  4. Replies: 6
    Last Post: 05-14-2014, 04:56 PM
  5. [SOLVED] Clear contents of specific cells on the same row if a specific cell on that row is empty
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2014, 01:48 PM
  6. [SOLVED] Macro to copy specific data from one WB to specific cells in another WB based on specific
    By d_rose in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2014, 11:05 AM
  7. VBA Trying to pull specific Word table cells into specific Excel cells
    By ez08mbba in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-16-2012, 01:11 PM

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