+ Reply to Thread
Results 1 to 11 of 11

Count values which meet specific criteria

  1. #1
    Registered User
    Join Date
    10-21-2012
    Location
    south africa
    MS-Off Ver
    Excel 2007
    Posts
    10

    Count values which meet specific criteria

    I currently have a program to help with cake orders. It used a countif formula to count the number of cakes which have the same name and size and then adds it to a summary page which shows the orders for each month. The layout of the program is: Cake Flavour, Due Date (Split into 2 separate tabs, one with days in a drop down list 1-31 and the other with the month in a drop down list jan-dec)

    What i want to do is only count values that are in the first week of the month. So for 01-07 of any month it must count the the different number of each cake ordered.

    The Days are in cells C3:C51 and months in D3:D51.

    In cell E3:E51 it has the cake flavours that have been ordered and at the bottom of the page i have a countif to count the number of each different flavours in the range

    How can i do the countif but ONLY if the days equals less than 8 and the month equals only December for example

    Help will be much appreciated

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Count values which meet specific criteria

    Looks like to need COUNTIFS or SUMPRODUCT functions. Tyr with these OR upload a small sample workbook.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

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

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Count values which meet specific criteria

    Hi aroujo,

    Please upload a sample workbook. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Count values which meet specific criteria

    Hi,

    I'm thinking a Pivot Table is in your future. See the attached for an example of how I'd do this problem.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    10-21-2012
    Location
    south africa
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Count values which meet specific criteria

    Hi there and thanks for all the replies, in the pivot table that was attached what does the data where it says Jan and then 1 - 7 do those represent weeks??

    I have attached a copy of my worksheet to make it clearer
    Attached Files Attached Files

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Count values which meet specific criteria

    Hi araujo3rd,

    Here is how I'd do your whole problem. See the attached.
    I'd simply add to the bottom of the columns A - F more sales. You will put the cake name, size, how many, date and fill in the formula to do the month and week.
    I've created a Dynamic Named Range called "CakesDNR" which will know how much data the Pivot Table is supposed to grab
    I've created an Event Macro so the DNR will change if you change or fix or add any of the numbers.
    The Pivot Table allows you to filter the months you want to see. This would do the whole problem for you so you can start baking those cakes.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-21-2012
    Location
    south africa
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Count values which meet specific criteria

    You sir are a genius! thank you so much!

    However could u please help me to alter the program so that the user first selects the cake design they would like (e.g. IRIS or Butterfly etc), Then followed by the due date its needed (Perhaps a drop down calandar?) then followed by the flavour (E.g chocolate or vanilla etc, also in a drop down list) then followed by the sizes offered (also a drop down list with the sizes)

    Then in the pivot table is it possible to rather display the week of the month the order falls into rather than the actual week of the year. So if the order is between 01-07 december it will fall into week 1, 8-14 december into week 2, 15-21 december into week 3 and 22-31 december into week 4. That way it will make it easier to see exactly which cakes must be made in each week of the month! If this can be done my program will be hundreds!

    Thank you so much for all ur help and quick responses
    Last edited by araujo3rd; 12-07-2012 at 10:50 AM.

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Count values which meet specific criteria

    Hi araujo3rd,

    My old profession, many years ago, was a teacher. I continued learning new things by finding good examples and understanding how they worked. I have given you a good example to grow from. The task is now yours, or others to improve upon. I believe in teaching people, as in "how to fish" and hate simply giving them answers where they never learn new things themselves. It is your turn to learn from this example.

  9. #9
    Registered User
    Join Date
    10-21-2012
    Location
    south africa
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Count values which meet specific criteria

    I have spent countless hours trying to get it to do it and im just not getting anywhere hence why i came to the forums in the first place. I am willing to learn but need advice as to how to go about it

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Count values which meet specific criteria

    Hey - OK,

    You need to attach a list of all you possible cake types/names (IRIS, Butterfly, etc) and another list of all those colors you need. You should also tell me what sizes are allowed for each type of cake and color. The correct way to do this is to build validation lists of each cake type, flavor/color, size to make data entry easy and exact. As for a Calendar or DTPicker control, that is harder. It is doable but you need to change settings or references in your VBA editor.

    ALSO - you should have given me the exact format you want, now that I've shown you Pivot Tables. Then you should explain exactly what you require as an output in the Pivot.

    If you do this yourself, you'd see you can start keeping costs and profit by cake type or color or size by adding columns to the data.

    ALSO - I put in the number of cakes, in case you wanted to make 2 or 5 or 10 of them in a batch. You didn't have this noted in your example.

    This seems like one of those "never ending problems" where you will see new and better ways of doing things and want someone else to do it for you as an add-on....

  11. #11
    Registered User
    Join Date
    10-21-2012
    Location
    south africa
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Count values which meet specific criteria

    Ok thanks for all ur help, will keep working at it and hopefully will be up and running soon. Never expected anyone to do anything for me just needed some advice on how to go about it as it can be complicated especially since iv never used pivot tables before. Thanks for all ur advice and hopefully ill sort out this "never ending problem" soon

+ 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