+ Reply to Thread
Results 1 to 5 of 5

Struggling using countif

Hybrid View

SumeetPuri Struggling using countif 08-12-2013, 08:40 AM
XOR LX Re: Struggling using countif 08-12-2013, 08:48 AM
Richard Buttrey Re: Struggling using countif 08-12-2013, 08:57 AM
SumeetPuri Re: Struggling using countif 08-12-2013, 09:08 AM
SumeetPuri Re: Struggling using countif 08-12-2013, 09:45 AM
  1. #1
    Registered User
    Join Date
    08-12-2013
    Location
    Nottingham
    MS-Off Ver
    excel 2010
    Posts
    3

    Struggling using countif

    Hi,
    we sell many products online and in an effort to reduce cost, i have created excel sheet with various formula's for inventory
    This is how excel looks like
    a1: Cushions (code i use is "Cush01")
    a2: Hammock (code i use is "Hamm01")
    a3: 2 seat sofa (code i use is "2ss01")

    I use =CountIF(A10:A1000,"Cush01") and straight away we know how many cushions we have sold at a given time and whats the remaining stock of cushions.
    But 1 customer can buy multiple items, like cushions, hammock, 2 seat sofa etc. At the moment, for every item we have to create 3 entries in excel.

    Question: Can I use CountIf or any other formula to look for multiple codes in a cell that I have crated and reduce stock against the item purchased?

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Struggling using countif

    Hi,

    =SUMPRODUCT(COUNTIF(A10:A1000,{"Cush01","Hamm01","2ss01"}))

    will give you your desired result, though it's preferable again if you can list your criteria in cells, e.g. with "Cush01","Hamm01","2ss01" in B1, B2 and B3 respectively, this formula becomes:

    =SUMPRODUCT(COUNTIF(A10:A1000,B1:B3))

    This version will give you more dynamism; should you wish to change your criteria at any point, it will not be necessary to edit the formula(s) again, but simply the cells B1:B3.

    Regards
    Last edited by XOR LX; 08-12-2013 at 08:50 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Struggling using countif

    Hi,

    Not exactly sure what you're asking. When you mention multiple codes in a cell do you mean a single cell could contain
    "Cush01,Hamm01,2ss01"

    Neither am I sure what you mean by you need to add 3 entries in excel if the customer buys multiple items. Do you mean many items of the same product or multiple products. If the former why not add a quantity column?

    Why not upload an example workbook with a few records and manually add the results you expect to see telling us which are the result cells and what you've done to get the results unless it's not blindingly obvious.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    08-12-2013
    Location
    Nottingham
    MS-Off Ver
    excel 2010
    Posts
    3

    Re: Struggling using countif

    Many thanks for quick reply, i am so sorry if i wasn't clear earlier. I will try to explain again this time with example.

    A B C D E
    code total sold remaining
    1 cush01 10 5 5
    2 hamm01 10 4 6
    3 2ss01 10 1 9

    Formula that runs under D1 is =countif(110:I1000,"cush01")
    Formula that runs under D2 is =countif(110:I1000,"hamm01")
    Formula that runs under D3 is =countif(110:I1000,"s2201")

    this is how i do entries:
    Jo Smith 0777177777 Jo.S@gmail.com <Address> cush01 12.00 GBP

    this way, the sale is reflected in cell D1 and E1 calculates remaining stock by subtracting C1-D1

    But I am having to create separate entry if customer buys more than 1 product, like this one, where Jo Smith also bought Hammock
    Jo Smith 0777177777 Jo.S@gmail.com <Address> hamm01 99.00 GBP

    What I want is a formula that calculates and reflects the sale in D1, D2, D3 just by entering multiple codes in single cell

    May be something like this (note both codes appear in single cell)
    Jo Smith 0777177777 Jo.S@gmail.com <Address> cush01, hamm01 111.00 GBP

    Can you please advice what formula should go in cell D1, D2 and D3 so that it looks for their respective code and show sale against it

    Sorry to be a pin, but is this possible?

  5. #5
    Registered User
    Join Date
    08-12-2013
    Location
    Nottingham
    MS-Off Ver
    excel 2010
    Posts
    3

    Re: Struggling using countif

    CountIF.jpg

    kindly find attached screen shot

+ 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] Struggling with dates and COUNTIF
    By kguerrero in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-29-2012, 12:52 PM
  2. Struggling with IF
    By KClark in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-10-2011, 04:37 AM
  3. struggling
    By Tomas mcD in forum Excel General
    Replies: 1
    Last Post: 03-07-2011, 08:25 AM
  4. Struggling IF value
    By Rebecca in forum Excel General
    Replies: 5
    Last Post: 04-06-2006, 04:55 PM
  5. Help, I'm Struggling!
    By Fybo in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-04-2005, 04:06 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