+ Reply to Thread
Results 1 to 8 of 8

Count rows where meets two conditions

  1. #1
    Registered User
    Join Date
    02-16-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10

    Question Count rows where meets two conditions

    Hi Guys,

    I would really appreciate your help with a problem i havent been able to solve.

    I have filebin.net/fs4xd6hv4ibamp86 attached an example doc. You can think of this as a hourly sales report vs weekday. I have a table with two columns First a date and time collum containing e.g. "22/06/2020 16:32:47". and a seccond showing sale amount. Each row is a transaction we have had.

    I have a grid with hours going along the top, and day of week going down.

    I have been able to get total sales for example when day = monday and hour = 4pm using
    Please Login or Register  to view this content.
    But i need to get quantity for orders that also meet both these criterias. I can get one using
    Please Login or Register  to view this content.
    but need to ensure its also
    Please Login or Register  to view this content.

    Ive tried by doing
    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    Thank you for taking the time to read this and reply,

    Kindest Regards

    Paul

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Count rows where meets two conditions

    Please post a sample sheet ( see yellow banner)

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Count rows where meets two conditions

    How about
    =SUMPRODUCT((TEXT(Table1[Date],"dddd")=B7)*(TEXT(Table1[Date],"hh")="16"))

  4. #4
    Registered User
    Join Date
    02-16-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10

    Re: Count rows where meets two conditions

    Quote Originally Posted by Fluff13 View Post
    How about
    =SUMPRODUCT((TEXT(Table1[Date],"dddd")=B7)*(TEXT(Table1[Date],"hh")="16"))

    Perfect, Thank you

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Count rows where meets two conditions

    You're welcome & thanks for the feedback.

  6. #6
    Registered User
    Join Date
    02-16-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10

    Re: Count rows where meets two conditions

    A couple of side questions id appreciate your help with for

    Please Login or Register  to view this content.
    1) How can i have instead of saying ="16" it refrences cell C5 which ideally would contain "16:00"

    2) how do i lock the date collum, it doesnt seem to like adding $ in front like
    Please Login or Register  to view this content.
    Kindest Regards,

    Paul

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Count rows where meets two conditions

    You can use
    =SUMPRODUCT((TEXT(Table1[Date],"dddd")=B7)*(TEXT(Table1[Date],"hh")=TEXT(C5,"hh")))

    One of the problems with tables, is anchoring the columns. I know it's possible, but can't remember how.

  8. #8
    Registered User
    Join Date
    02-16-2016
    Location
    England
    MS-Off Ver
    2007
    Posts
    10

    Re: Count rows where meets two conditions

    Thank You again, The solution was to Duplicate the column references as if referring to multiple columns.

    E.g.
    Please Login or Register  to view this content.
    Last edited by AliGW; 07-06-2020 at 08:26 AM. Reason: Please don't quote unnecessarily!

+ 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 count rows where one column meets criteria based on another column
    By gavsenior in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2018, 07:30 AM
  2. Count rows in an array where any cell on each row meets criteria.
    By nigeli in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-28-2015, 05:27 PM
  3. Replies: 8
    Last Post: 07-17-2013, 02:13 PM
  4. Count nr of rows if condition meets
    By tahirawan11 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-08-2013, 05:21 AM
  5. To get the count of cells which meets multiple conditions
    By sreerag446 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2008, 01:21 AM
  6. Count the number of rows where more than one column meets set crit
    By BarrieVoice in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-14-2006, 02:30 PM
  7. [SOLVED] Count Cells if diff cell meets conditions
    By DJS in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-12-2006, 11:50 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