+ Reply to Thread
Results 1 to 14 of 14

sumif 2 conditions are met

  1. #1
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    sumif 2 conditions are met

    In column A I have various accounts (A, B, C, D, E, etc.). In column B I have an amount of money deposited into the account in column A; in column C is the date of the deposit, and in column E is jumbled text, but each deposit includes the words "Dividend", "Interest", or "Capital Gain" somewhere in the jumbled text.

    In column E, I want to sum all of, say, the Dividends per account per date; I want to match the account in column A with the text in column D. For example, I want column E to list the Dividends from Account A on any particular date. I think it has to do with the SUMIFS function with an accompanying AND function, but I cant figure out how to parse out the matching language (in this case "Dividend") from column D.

    Here is as far as I got: Column E=Sumifs(And(A:A="Account A"),(D:D="*Dividends*"),B:B), but it doesnt seem to work.
    Any ideas?

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: sumif 2 conditions are met

    a sample workbook would be very helpful but attached is my guess based on what you wrote...

    =SUMIFS($B$2:$B$6,$C$2:$C$6,$F$1,$D$2:$D$6,"*dividend*")
    see col E in attachment
    Attached Files Attached Files
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    Why can i not open the file?

  4. #4
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    Opened. Works great for the one date. What if I want to sum dividends for Account A over a period of several days?

  5. #5
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    Question: Per your spreadsheet, there should only be $500 in dividends going into the Savings Account; you show $1000 (the other $500 should go into the Checking Account); $200 in interest into the Checking Account (the other $100 into the Savings Account); and, $300 Capital Gains into the Savings Account

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: sumif 2 conditions are met

    As I mentioned in my post, a sample workbook with data AND expected results (hand entered) would be very helpful. It doesn't have to be a lot of data, just enough to show what you actually have and what you want.

    So I'm reattaching the workbook with some adjustments that will give you a date range, and the amounts may be ridiculous but they are just examples to show you the formula and how it works.
    =SUMIFS($B$2:$B$11,$C$2:$C$11,"<"&EOMONTH($F$1,0),$C$2:$C$11,">"&EOMONTH($F$1,-1),$D$2:$D$11,"*dividend*")

    And if for example you put the word dividend in say cell G1 and interest in another cell you can alter the formula like this ...
    =SUMIFS($B$2:$B$11,$C$2:$C$11,"<"&EOMONTH($F$1,0),$C$2:$C$11,">"&EOMONTH($F$1,-1),$D$2:$D$11,"*"&$G$1&"*")

    just realized you might want it to include the last day of the month so adjust the "<" to "<=" to include the last day of the month for the first EOMONTH formula. You want it to be ">" for the other EOMONTH(F1,-1) so it only gets the current month.
    Attached Files Attached Files
    Last edited by Sam Capricci; 02-18-2024 at 09:42 AM.

  7. #7
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    One last question: what if we eliminated the date reference completely and just entered the value in the cell when the account ("Account A") "matched" the Dividend deposit? What would the formula look like? I tried deleting the date reference, but it wouldnt work

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: sumif 2 conditions are met

    well the formulas I gave you reference a date, I'm not really sure what you are asking for in post #7, remember I just mocked up a workbook based on a guess and what you wrote.
    I mentioned in post #2 and again in #6 that a sample workbook would go a long way to getting you the formula you want/need.

  9. #9
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    How would I simply eliminate the date completely and "match" only when, say, dividends are deposited into Account A?

  10. #10
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: sumif 2 conditions are met

    Ok, if you want to eliminate the date and date reference but just want to focus on the match a word part then you would delete the sections in bold red...
    =SUMIFS($B$2:$B$11,$C$2:$C$11,"<="&EOMONTH($F$1,0),$C$2:$C$11,">"&EOMONTH($F$1,-1),$D$2:$D$11,"*"&$G$1&"*")
    so that you would just search for the word "dividend" in this case which I left in cell G1 so it would look like this...
    =SUMIFS($B$2:$B$11,$D$2:$D$11,"*"&$G$1&"*")
    in fact a sumif would work for that which would be... =SUMIF($D$2:$D$11,"*"&$G$1&"*",$B$2:$B$11)
    or hardcoding in the word dividend then... =SUMIF($D$2:$D$11,"*dividend*",$B$2:$B$11)

  11. #11
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    That works fine if you want to match only the dividend piece...but how do I incorporate matching the Account piece as well? That is, I want to show the deposit when its a Dividend and its deposited into Account A. I tried the following:

    =sumifs(and((a:a,"Account A"),(d:d,"*dividend*")),c:c,0) and the same formula without to zero at the end, and neither worked.

  12. #12
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    I think I solved it:

    =IF(A2<>"Account A",0,SUMIF(E2,"*DIV*",B2))

    What do you think?

  13. #13
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: sumif 2 conditions are met

    your formula is not doing any "math", it is just looking for two texts in two different cells to return a value. I thought you were looking for a function to add up values that met criteria from two different columns.
    you can get the same thing with other formulas too like ... =IF(AND(A2="Account A",ISNUMBER(SEARCH("DIV",E2))),B2,0) or this ... =IF(SUMIFS(B2,A2,"account a",E2,"*div*"),B2,0)
    so if what you wrote gives you what you wanted, go with it, there isn't a right or wrong as long as you get the answer you are looking for as there are possibly dozens of formulas that might return the value you are looking for.

  14. #14
    Registered User
    Join Date
    07-13-2005
    Location
    Louisville ky
    MS-Off Ver
    2018
    Posts
    85

    Re: sumif 2 conditions are met

    Thanks again

+ 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. Sumif with conditions?
    By WHWALDREP in forum Excel General
    Replies: 1
    Last Post: 12-06-2009, 11:15 AM
  2. SUMIF with 2 conditions.
    By Martinac in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-15-2007, 05:03 AM
  3. [SOLVED] SUMIF 2 conditions are met???
    By Granger in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-17-2005, 03:35 PM
  4. SUMIF with 2 conditions
    By Peo Sjoblom in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 09-06-2005, 07:05 PM
  5. SUMIF with 2 conditions
    By Peo Sjoblom in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 09-06-2005, 05:05 AM
  6. SUMIF with 2 conditions
    By Simon in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. [SOLVED] sumif with 3 conditions
    By Robbert in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 01:05 AM
  8. [SOLVED] sumif with 2 conditions ?? can this be done??
    By WTG in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-04-2005, 06:05 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