+ Reply to Thread
Results 1 to 6 of 6

Sum function with a condition

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

    Sum function with a condition

    Is there any way every time I submit data with userform (on this case, it would be "Categoria" column and "Total" column.) it keeps sum Total column values from a specify category ("Categoria" column).
    For example: every time I submit data on "Casa" category, it would check every row with "Casa" and sum theirs values.
    If we take this workbook print as an example, it would have to be =sum("J22","J25","J26","J27")and If I added one more row with "Casa", for example, it would be =sum("J22","J25","J26","J27","J28").

    For "Casa" category values, the result from this sum would go to G27.

    I guess I'd have to post all code here, but instead of it, I'm attaching the actual workbook here. Think it will be better for you.

    This is my workbook:
    c3013dc.png
    Attached Files Attached Files
    Last edited by luizmachado; 01-21-2016 at 12:42 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    Sunderland, England
    MS-Off Ver
    Excel 2007 (Home) / 2003 (Work)
    Posts
    740

    Re: Sum function with a condition

    =SUMIF(Table1[Categoria],Table2[[#This Row],[Categoria]],Table1[Total])

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

    Re: Sum function with a condition

    This way it'll sum all "Categoria" column. I'd like that to sum all "Casa" category values from "Total" column. =(

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

    Re: Sum function with a condition

    I translated most of it to english, so I guess It will be easier to you guys see it.
    Test.xlsm
    Last edited by luizmachado; 01-21-2016 at 01:36 PM.

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

    Re: Sum function with a condition

    Don't anyone know? I think that this =SUMIF(Table1[Categoria],Table2[[#This Row],[Categoria]],Table1[Total]) is a start, but I don't know how to rearrange it to work.

    The code should check data every time it changes. As the example above, if I have J22/25/26/27 filled and on "Casa" category, it has to sum them all. And if some new data appears, for example, on J28 and it's from "Casa" category, it should "sum it to the code", like "=sum("J22","J25","J26","J27","J28") on "G27" ("Casa" total value).

    My idea is that the table is always updated, even I someone makes a small mistake (like a wrong value) and wants to changes it on the table (instead of deleting all row to add it again by the userform).

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

    Re: Sum function with a condition


+ 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. How to if function for between condition
    By Terressa in forum Excel General
    Replies: 3
    Last Post: 07-01-2015, 05:55 AM
  2. I need help with a function, how to sum a row on a condition.
    By Caveman1200 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2013, 06:05 PM
  3. [SOLVED] IF function, I need one more condition
    By rwbaldwin0728 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-02-2013, 06:07 AM
  4. [SOLVED] Can I add an 'or' condition to the COUNTIF function? If not, what other function can I use
    By newbie0101 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-09-2012, 01:41 AM
  5. Many Condition with IF Function
    By Aumkar in forum Excel General
    Replies: 10
    Last Post: 07-30-2010, 08:08 AM
  6. If function 10 condition
    By Sam.K in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-01-2008, 11:20 PM
  7. [SOLVED] max function with condition
    By shaji in forum Excel General
    Replies: 4
    Last Post: 07-10-2006, 12:19 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