+ Reply to Thread
Results 1 to 4 of 4

Countif only if values in two ranges are found

  1. #1
    Registered User
    Join Date
    07-20-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    15

    Countif only if values in two ranges are found

    I have two columns A (items) and B (store names). I need to check the ranges A:A and B:B and count how many times a certain item appears in column A AND a certain store appears in column B. For example I want to see how many times the item "plates" are listed for the store "walmart". If I had the following data

    napkins walmart
    plates walmart
    forks target
    plates walmart
    spoons target

    I should get an answer of 2 because "plates" AND "walmart" appear in the same row twice. If I asked for "spoons" and "target" I would get 1, and if I asked for "spoons" and "walmart" I would get 0. Is there are formula that I can use to check the same row in two different columns for certain values and count the rows that have those values?

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Countif only if values in two ranges are found

    Try

    =SUMPRODUCT((A1:A5="plates")*(B1:B5="walmart"))
    or
    =COUNTIFS(A:A,"plates",B:B,"walmart")

    You can also use cell references instead of text
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    07-20-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Countif only if values in two ranges are found

    Quote Originally Posted by Ace_XL View Post
    Try

    =COUNTIFS(A:A,"plates",B:B,"walmart")
    I tried that earlier and it didn't return the correct answers. Now that I see that I was on the right track, I looked back to see what I did wrong, and it turns out I needed to add a few '$' to the formula since I had dragged it to other columns. It was looking at the wrong columns to compare! Thanks for the help!

  4. #4
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: Countif only if values in two ranges are found

    :D
    Happens all the time....

    Please make your Post as solved if you got what you need
    Please make the Post as solved, when you get your answer & Click * if you like my suggestion

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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