+ Reply to Thread
Results 1 to 28 of 28

Help with COUNTIFS and/or SUMPRODUCT

  1. #1
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Help with COUNTIFS and/or SUMPRODUCT

    I've got a daily dataset that is non-continuous...it's a count of severe weather reports. So there can be gaps of several days with no reports. However, I need to get a count of report types by day and be able to fill a continuous timeline, including with zeros. Can anybody tell me what formula I can use to obtain, for example, a count of instances of "Thunderstorm Wind" in Column A for each date and have that populate Column F? I've experimented with both COUNTIFS and SUMPRODUCT but haven't had any luck? I need a formula in Column F that says:

    1) The dates in Columns B & E match

    AND

    2) Column A = "Thunderstorm Wind"

    Dates Table.PNG

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Try

    =SUMPRODUCT(--(A2:A33="Thunderstorm Wind"),--(B2:B33=E2:E33))

  3. #3
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    I tried that with a slight modification...Columns A & B extend down to Row 203 and Column E extends to Row 6562...

    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--(B2:B203=E2:E6562))

    And I get a "Value Not Available" error...

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    OK, Misunderstood...

    your description sounded like you wanted to
    Count row 2 if A2 = Thunderstorm wind, AND B2 = E2
    Count row 3 if A3 = Thunderstorm wind, AND B3 = E3
    etc.


    But it appears you want
    Count row 2 if A2 = Thunderstorm wind, AND B2 exists anywhere in E2:E6562
    Count row 3 if A3 = Thunderstorm wind, AND B3 exists anywhere in E2:E6562

    Is that right?

  5. #5
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Yes...I think you've got what I'm looking for. Sorry for the confusion.

    As an example from my table above, there are 2 instances of "Thunderstorm Wind" on 1/18/1979 (cells A8 and A9). I'm looking for a formula that can read that and place a "2" in cell F19. Make sense?

  6. #6
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,211

    Re: Help with COUNTIFS and/or SUMPRODUCT

    =countifs(A:A,"Thunderstorm Wind",B:B,E2)

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Try

    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(B2:B203,E2:E6562,0)))

  8. #8
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by Jonmo1 View Post
    Try

    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(B2:B203,E2:E6562,0)))
    Seems to just return a list of zeros.

  9. #9
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by davsth View Post
    =countifs(A:A,"Thunderstorm Wind",B:B,E2)
    Is this saying 'countif' anything in Column A = "Thunderstorm Wind" and anything in Column B = E2?

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    According to the picture you posted (an actual excel file attachment would be more helpful)
    Judging by the left/right alignment of values in B and E, It looks like the dates in column B are not really dates, just Text strings that look like dates.
    But Column E is real dates.

    Test with these
    =ISNUMBER(B2)
    =ISNUMBER(E2)
    Are they TRUE or FALSE ?

  11. #11
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by Jonmo1 View Post
    According to the picture you posted (an actual excel file attachment would be more helpful)
    Judging by the left/right alignment of values in B and E, It looks like the dates in column B are not really dates, just Text strings that look like dates.
    But Column E is real dates.

    Test with these
    =ISNUMBER(B2)
    =ISNUMBER(E2)
    Are they TRUE or FALSE ?
    B2 = FALSE
    E2 = TRUE

    Excel file at link below...working off of Sheet 3:

    https://nofile.io/f/gCfCPDygBjr/1979...+Filtered.xlsx

  12. #12
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by bayouwxman View Post
    B2 = FALSE
    E2 = TRUE

    Excel file at link below...working off of Sheet 3:

    https://nofile.io/f/gCfCPDygBjr/1979...+Filtered.xlsx
    That file hosting site is taking a while...try this link instead:

    http://bit.ly/2ntHQIJ

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Yep, dates in B are not real dates. They'll need to be converted.
    Try copying an empty cell
    highlighting B
    Right Click - Paste Special - Values - Add.

  14. #14
    Forum Contributor
    Join Date
    07-06-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    192

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by bayouwxman View Post
    B2 = FALSE
    E2 = TRUE

    Excel file at link below...working off of Sheet 3:

    https://nofile.io/f/gCfCPDygBjr/1979...+Filtered.xlsx

    I guess the B2 date is text. try add in a Value.

    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(VALUE(B2:B203),E2:E6562,0)))

  15. #15
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by Jonmo1 View Post
    Yep, dates in B are not real dates. They'll need to be converted.
    Try copying an empty cell
    highlighting B
    Right Click - Paste Special - Values - Add.
    So copy Column B and then right click - paste special - values? I'm not seeing an "add" anywhere...probably a stupid question.

  16. #16
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,211

    Re: Help with COUNTIFS and/or SUMPRODUCT

    I do not have 2016 but under paste special you should have a section called operation you can select add and likewise values in the paste section

    http://www.dummies.com/software/micr...in-excel-2016/

  17. #17
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by finalazy View Post
    I guess the B2 date is text. try add in a Value.

    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(VALUE(B2:B203),E2:E6562,0)))
    That returns a count of the total instances of "Thunderstorm Wind" in Column A but I need a count tied to each specific date.

  18. #18
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    No, copy an empty cell

    Then highlight column B
    Right Click -Paste Special (you have to actually click where it says paste special, don't just hover your mouse over it)
    Select Values and Add, Click OK

  19. #19
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by Jonmo1 View Post
    No, copy an empty cell

    Then highlight column B
    Right Click -Paste Special (you have to actually click where it says paste special, don't just hover your mouse over it)
    Select Values and Add, Click OK
    Sorry...didn't quite understand the copy an empty cell at first. That returned a list of numbers beginning with 28856:

    Web.png

  20. #20
    Forum Contributor
    Join Date
    07-06-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    192

    Re: Help with COUNTIFS and/or SUMPRODUCT

    oh =\ i guess that didn't work. Try converting this way. select the column B, go data tab and choose text to columns, click on next until you reach step 3 of 3, where you will see 4 option, select Date and press finish. See if that helps

  21. #21
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    I've got the dates for Column B in a separate sheet but they also include the time. I don't need the time so I had removed it before moving the dates into this sheet...

    Web2.png

  22. #22
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,211

    Re: Help with COUNTIFS and/or SUMPRODUCT

    This is why posting an attachment is so much better than screenshots

    all the dates should be dates, it makes life so much simpler however

    =SUMPRODUCT(($A$1:$A$203="Thunderstorm Wind")*(TEXT($B$1:$B$203,"M/d/YYYY")=E1))

    might give the answer you want

  23. #23
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by finalazy View Post
    oh =\ i guess that didn't work. Try converting this way. select the column B, go data tab and choose text to columns, click on next until you reach step 3 of 3, where you will see 4 option, select Date and press finish. See if that helps
    It looks like that worked...thanks!

    Now...I've lost track...which formula should I try at this point?

  24. #24
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Based on you agreeing with my understanding as described in post # 4
    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(B2:B203,E2:E6562,0)))

    Now with new information that B includes the TIME with the date, but E does not...
    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(INT(B2:B203),E2:E6562,0)))

  25. #25
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by Jonmo1 View Post
    Based on you agreeing with my understanding as described in post # 4
    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(B2:B203,E2:E6562,0)))

    Now with new information that B includes the TIME with the date, but E does not...
    =SUMPRODUCT(--(A2:A203="Thunderstorm Wind"),--ISNUMBER(MATCH(INT(B2:B203),E2:E6562,0)))
    So I just retried this from @davsth and it appears to work:

    =countifs(A:A,"Thunderstorm Wind",B:B,E2)


    Thanks to everyone for the help...really appreciate it!

  26. #26
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by bayouwxman View Post
    So I just retried this from @davsth and it appears to work:

    =countifs(A:A,"Thunderstorm Wind",B:B,E2)
    Are you sure?
    That isn't doing what we talked about in post # 4 and 5.

    It will do this instead..
    Count Row 2 if A2 = "Thunderstorm Wind" AND B2 = E2
    Count Row 3 if A3 = "Thunderstorm Wind" AND B3 = E2
    Count Row 4 if A4 = "Thunderstorm Wind" AND B4 = E2
    etc.

    I guess I really misunderstood your requirement.

  27. #27
    Forum Contributor
    Join Date
    07-06-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    192

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by Jonmo1 View Post
    Are you sure?
    That isn't doing what we talked about in post # 4 and 5.

    It will do this instead..
    Count Row 2 if A2 = "Thunderstorm Wind" AND B2 = E2
    Count Row 3 if A3 = "Thunderstorm Wind" AND B3 = E2
    Count Row 4 if A4 = "Thunderstorm Wind" AND B4 = E2
    etc.

    I guess I really misunderstood your requirement.

    Yea Jon, i thought so as well. I think initially you already provide the formula he wanted just that the B column date is in text which perhaps causes the problem.

  28. #28
    Registered User
    Join Date
    01-31-2018
    Location
    Baton Rouge, LA
    MS-Off Ver
    Office 2016
    Posts
    16

    Re: Help with COUNTIFS and/or SUMPRODUCT

    Quote Originally Posted by Jonmo1 View Post
    Are you sure?
    That isn't doing what we talked about in post # 4 and 5.

    It will do this instead..
    Count Row 2 if A2 = "Thunderstorm Wind" AND B2 = E2
    Count Row 3 if A3 = "Thunderstorm Wind" AND B3 = E2
    Count Row 4 if A4 = "Thunderstorm Wind" AND B4 = E2
    etc.

    I guess I really misunderstood your requirement.
    I apologize if I wasn't clear but that formula is accomplishing exactly what I needed as seen in the screenshot below...

    Web3.PNG

+ 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] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  2. Dynamically Use Countifs or Sumproduct
    By jeffbaranda in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-27-2016, 04:50 PM
  3. [SOLVED] Sumproduct + countifs
    By toci in forum Excel Formulas & Functions
    Replies: 30
    Last Post: 03-27-2016, 04:09 PM
  4. [SOLVED] CountIfS and SUMPRODUCT need help
    By rschoenb in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2014, 11:21 PM
  5. [SOLVED] Sumproduct/countifs
    By mahat in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-21-2014, 10:30 PM
  6. COUNTIFS and SUMPRODUCT help
    By Stacy1 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-19-2013, 02:35 PM
  7. Using SUMPRODUCT instead of COUNTIFS
    By SymphonyTomorrow in forum Excel General
    Replies: 12
    Last Post: 11-18-2011, 05:01 PM

Tags for this Thread

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