+ Reply to Thread
Results 1 to 8 of 8

Cumulative sum with a condition

  1. #1
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Cumulative sum with a condition

    Basically I'm writing above what should happen and what is happening, I guess it'll be easier to understand.
    Ps: I uploded the file below.

    -----------------------------------------------------------------------------
    What IS happening (in the file below):
    First entry
    if category (categoria) is "mercado", G10 will receive G10 value + K22 value
    Segunda entrada
    if category (categoria) keeps being "mercado", G10 will receive G10 value + K23 value
    Terceira entrada
    if category (categoria) keeps being "mercado", G10 will receive G10 value + K24 value
    Quarta entrada
    if category (categoria) IS NOT "mercado", but "lazer" G9 will receive G9 value + K25 value
    Quinta entrada
    if category (categoria) is "mercado" again, G10 will receive G10 value + K26 value

    This way when I change K22 value in the table, G10 won't change.
    -----------------------------------------------------------------------------

    What SHOULD happen:
    First entry
    if category (categoria) is "mercado", G10 will receive K22
    Second entry
    if category (categoria) keeps being "mercado", G10 will receive K22+K23
    Third entry
    if category (categoria) keeps being "mercado", G10 will receive K22+K23+K24
    Fourth entry
    if category (categoria) IS NOT "mercado", but "lazer", for example, G9 will receive K25
    Quinta entrada
    if category (categoria) is "mercado" again, G10 will receive K22+K23+K24+K26

    This way I'm able to change K22 value in table and it will change in G10.
    And it should work for the nexts entries, with this same pattern.

    -----------------------------------------------------------------------------

    In order to insert any data, click on "INSERIR DEPESAS".

    Thanks,
    Luiz.
    Attached Files Attached Files
    Last edited by luizmachado; 03-02-2016 at 03:07 PM.

  2. #2
    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,048

    Re: Cumulative sum with a condition

    I uploaded the file in my dropbox account because it's larger than 1000kb.
    https://www.dropbox.com/s/6ckoef66ug...este.xlsm?dl=0
    If it is too large to load here, then make it smaller. All we need is enough data to see what you are working with, and what you want.

    Please upload your file to the forum. Not all members are able - or willing - to access file-hosting sites
    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

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Cumulative sum with a condition

    Hello luizmachado,

    Have you tried to convert your Workbook to a "Zip" format, and check if it may then be smaller than 1Meg?

    Even if that does not work, just upload a downsized sample Workbook, which should be good enough for us to work from.

    Regards.

    P.S.

    @ FDibbins,

    Please stop being faster than me!
    Last edited by Winon; 03-02-2016 at 02:28 PM.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  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,048

    Re: Cumulative sum with a condition

    LOL jammer ou maat
    Hey, coming to SA again in august

  5. #5
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Cumulative sum with a condition

    Right here, guys! =)

    I edited it keeping the important part.

    Thanks,
    Luiz.
    Attached Files Attached Files

  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,048

    Re: Cumulative sum with a condition

    maybe this?
    =SUMIF(D:D,D22,L:L)

  7. #7
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Cumulative sum with a condition

    No way it was this simple!!

    I made a little change:
    (this one below works for "mercado", because it checks with F10)
    =SUMIF(D:D; F10; K:K)

    This worked pretty well for me!!

    Ps: I guess that you meant K:K, instead of L:L, but anyway, it helped a lot!!

    Thank you again!! =)

  8. #8
    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,048

    Re: Cumulative sum with a condition

    Simple is always best

    Happy to help and thanks for the feedback

+ 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] My vba Transpose with condition, but its transposing the condition from other range
    By Franky alta in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-28-2015, 03:56 PM
  2. Replies: 7
    Last Post: 06-01-2015, 06:05 PM
  3. Condition formatting of multiple condition formatted cells
    By merrin84 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-22-2015, 05:08 PM
  4. [SOLVED] IF the condition of gender is met AND the condition of age is met subtract this number
    By arsenalmom in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-16-2014, 11:16 PM
  5. Formulas for cumulative value and cumulative %
    By Brotein in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-28-2013, 07:19 PM
  6. [SOLVED] Help for if condition formula result only either hit or miss from mulitple condition
    By breadwinner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 07:29 AM
  7. multi condition format? lookup and date condition valid for.
    By D_Rennie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-13-2009, 11:37 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