+ Reply to Thread
Results 1 to 21 of 21

SUM only the number of cells specified by the Logical Argument

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    SUM only the number of cells specified by the Logical Argument

    I want to be able to SUM specified cells in a column based on the Logical_Test of an IF formula:

    Please Login or Register  to view this content.
    The above Logical_Test resolves to '3', so if the logical test is true, I only want to SUM the first three cells, i.e. C7, C20 and C33, then when the logical_test resolves to 4, it will SUM C7, C20 C33 and C46 and so on.

    Is there any way to achieve this or can it be achieved with a different formula?

    Many thanks
    Attached Files Attached Files
    Last edited by HangMan; 07-01-2015 at 03:57 AM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUM only the number of cells specified by the Logical Argument

    You get better help on your question if you add a small excel file, without confidential information.

    Please also add manualy the expected result in your file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    oeldere,

    Sample attached...

    Results wise, using the sample attached to 'this' post, with the formula

    Please Login or Register  to view this content.
    I would expect the result for column B to be 2,391, i.e. the SUM of B2, B15 and B28 and the result for column C to be 298 because the Logical_Test resolves to three, so it should only SUM the first three values in the list,then when the Logical Test resolves to 4, it will SUM the first 4 values ion the list and so on.

    Many thanks
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUM only the number of cells specified by the Logical Argument


  5. #5
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    I realise I could easily show this using a pivot table, but I have a very specific need to show these as totals at the bottom of my sheet, so a pivot won't work, hence the formulaic approach.

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUM only the number of cells specified by the Logical Argument

    Please Login or Register  to view this content.
    show it manualy in your file.

  7. #7
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    This needs to autoupdate each month which is the whole purpose of trying to do this with a formula, no user interaction required.

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUM only the number of cells specified by the Logical Argument

    This can be done with a pivot table (and I guess will take less actions to update, regarding a formula).

    But, you don't show what the result is, as requested.

  9. #9
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    The result is shown in the attachment and detailed in my post at 9.10am. I realise this can be easily achieved using a pivot table however a pivot table is not what I'm looking for here, this needs to be formulaic I'm afraid.

    Many thanks

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUM only the number of cells specified by the Logical Argument

    Please Login or Register  to view this content.
    I don't see any data on the bottom of the sheet (in #3) !!!!!

  11. #11
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    That is the point, this is where I'm needing a formula to create the totals based on the criteria in the fourmula, so if this element:

    Please Login or Register  to view this content.
    = 3, which it currently does then the formula should only sum the first three cells specified, i.e. B2, B15 and B28, if it = 4 then it sums B2, B15, B28 and B41 and so on. I'm thinking there needs to be an array of something, I just don't know how to do tis using a formula.

    Please Login or Register  to view this content.
    Does that help?

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUM only the number of cells specified by the Logical Argument

    Please also add manualy the expected result in your file.

    One last shot:

    as request in 2, 6, 8 and 10

  13. #13
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    Hi oeklere,

    The expected result is in 2nd the attachment posted at 9.10am as mentioned above...

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUM only the number of cells specified by the Logical Argument

    I quit, maybe another forummember is willling to help you.

  15. #15
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    I'm sorry you feel that way, I posted a question asking for help with a formula, you asked for the expected answer, which is both in my posts and in the attached file and all you've done is say use a pivot table. If I'd wanted to use a pivot table and couldn't do it I'd have posted a question about how to create a pivot table.

    I don't understand why this is a problem, it was a simple request and I provided all the information you asked for, but thanks for you time anyway.

  16. #16
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: SUM only the number of cells specified by the Logical Argument

    OK. I was able to do it with a helper column. I hope you can use a helper column. I put your logical statement in cell E1. Column D is the helper that checks to see how many should be added up. F1 has the result you want which will change any time the logical statement does.
    I know that is not as fun as having it all in one formula, but is that something you can work with?
    Attached Files Attached Files
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  17. #17
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    Hi nigel,

    I very much appreciate your help... A helper column is likely to be an issue owing to the nature of the workbook but if this is the only way, I will have to find a workaround. I had wondered if this could be done using an array, so the array becomes the cells listed in the formula and somehow the formula then sums just the number of cells equal to the value of the logical test if that makes sense.

    Thanks for this for now though...

  18. #18
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: SUM only the number of cells specified by the Logical Argument

    I think this will work better for you. This formula is in G1:
    Please Login or Register  to view this content.
    E1 still has your logical formula. You can put that part back into this formula if you want to, in place of the E1 references. It just makes it hard to read and understand what is going on.
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    That did the trick, perfect... I've put E1 back into the formula, it just keeps everything really neat. I take on board what you are saying about readability but that's not an issue in this case...

    Many thanks for your help, very much appreciated.

  20. #20
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: SUM only the number of cells specified by the Logical Argument

    This would also work. It just sums every 13th row starting with the 2nd row. This way you don't have to worry if the word Month is in column A. E1 still has the logic formula.
    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: SUM only the number of cells specified by the Logical Argument

    Um, now why didn't I think of that, that is a far more sensible and practical solution and like you say avoids the exclusion of the word Month, which is a good thing...

    Many thanks once again... greatly appreciated.

+ 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. Replies: 7
    Last Post: 01-07-2015, 06:29 AM
  2. Replies: 5
    Last Post: 03-04-2012, 03:06 PM
  3. need help in logical argument
    By phatus in forum Excel General
    Replies: 4
    Last Post: 10-09-2011, 04:28 AM
  4. Replies: 3
    Last Post: 04-28-2010, 05:54 PM
  5. multiple logical tests as argument in Database function
    By riwiseuse in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-09-2009, 07:45 AM

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