+ Reply to Thread
Results 1 to 6 of 6

How to total how many times an item appears, with a condition

  1. #1
    Registered User
    Join Date
    03-05-2013
    Location
    United Kingdom
    MS-Off Ver
    Version 2210
    Posts
    22

    How to total how many times an item appears, with a condition

    Hi!

    I have two sheets in my spreadsheet. The first sheet (titled "Customers") shows a list of the customers (column A), the item they bought (in column B, each item is listed by its reference number) and whether they are to be shipped (column C - "yes" for shipping).

    In the second sheet (sales) I have a list of all the items by reference number (column A) and a column (B) in which I want to put the total number to be shipped for the item.

    I am struggling to find a formula that does what I want.

    For column B in my second sheet, I can use the formula =COUNTIF(Customers!B:B,Sales!A2) to show me how many customers bought the item in total, but what I can't get it to do is to only count the customers who have a "yes" in the shipping column. So I want to count how many times the item appears but only if there is a yes in column C.

    Any help will be greatly appreciated! Thank you.

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: How to total how many times an item appears, with a condition

    Pls upload a sample excel file
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: How to total how many times an item appears, with a condition

    If you use XL2007 or later you can try it with COUNTIFS (for multiple conditions):

    =COUNTIFS(Customers!B:B,Sales!A2,Customers!C:C,"yes")

    However, your profile shows that you are using XL2003, and COUNTIFS isn't available in that version. You could try SUMPRODUCT instead, though you can't use full-column references:

    =SUMPRODUCT((Customers!B$1:B$5000 = Sales!A2)*(Customers!C$1:C$5000 = "yes"))

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    03-05-2013
    Location
    United Kingdom
    MS-Off Ver
    Version 2210
    Posts
    22

    Re: How to total how many times an item appears, with a condition

    Thanks for any help you can give. Here's a sample spreadsheet, it's column B on the second page that I am struggling with.

    Best Wishes,

    lauracvpSample.xlsx

  5. #5
    Registered User
    Join Date
    03-05-2013
    Location
    United Kingdom
    MS-Off Ver
    Version 2210
    Posts
    22

    Re: How to total how many times an item appears, with a condition

    Perfect, that's it Pete! I have been struggling with this for ages so am VERY grateful to you!

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: How to total how many times an item appears, with a condition

    You're welcome. Please update your profile (as you attached an .xlsx file).

    Pete

+ 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. # Times Name Appears given a condition in a table
    By BlueValentine in forum Excel General
    Replies: 5
    Last Post: 03-20-2013, 07:33 PM
  2. Replies: 1
    Last Post: 11-01-2012, 08:37 AM
  3. Replies: 12
    Last Post: 07-21-2011, 09:29 PM
  4. Total times each word appears
    By JPKenny in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-08-2010, 08:15 PM
  5. I want a box with the total number of times ORDER appears!
    By tapley in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-23-2006, 09:20 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