+ Reply to Thread
Results 1 to 8 of 8

Countif and Using WildCard

  1. #1
    Registered User
    Join Date
    01-19-2011
    Location
    Metairie, LA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Countif and Using WildCard

    I have attached a spreadsheet. I am using the Countif to count how many employees I had for every pay period. It seems to be working but I have about 52 weeks. I need to know how to use this formula so that I done have to manually adjust the date for every week.

    This is the formula I am using:

    =COUNTIF(Data!C2:C660,"4/1/2010") The formula is in column B - using data in the same workbook - sheet 2.
    Attached Files Attached Files

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Countif and Using WildCard

    Your dates seem to be inconsistent just by the 3 example you give: April 1/10 is a Thursday while Apr 9 & 16 are Fridays.
    So the best way for you to do it would be either:
    Add a column to sheet "Form" which would hold the dates and have your formula refer to that column
    OR
    You can use COUNTIFS() function to count within a range of dates.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Countif and Using WildCard

    As Cutter states there are a few things that need clarifying.

    You have more than one years data in your sample.
    Does each year have to be calculated separately?

    You have a number of negative values in "Gross" and you have a column for <= 300. Why?

    Have a look at this workbook, I have added columns to both sheets, some might not be needed, but I have left in to help clarify the problems.

    Select a year from the drop-down in Sheet "Form" A1

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Countif and Using WildCard

    Using your original sample file - my take on it would be to put a reference date corresponding to the Friday of whatever Week 1 would be in a cell - I have used Jan 8, 2010 in F1 as an example.

    Then in B2 (and copied) down put this formula:
    =COUNTIFS(Data!C:C,"<="&$F$1+(RIGHT(A2,LEN(A2)-5)-1)*7,Data!C:C,">"&$F$1+7*(RIGHT(A2,LEN(A2)-5)-2),Data!D:D,">300")

    The references to the Week #'s in col A can be changed to ROWS() functions like this:
    =COUNTIFS(Data!C:C,"<="&$F$1+(ROWS($2:2)-1)*7,Data!C:C,">"&$F$1+7*(ROWS($2:2)-2),Data!D:D,">300")
    Last edited by Cutter; 05-29-2011 at 01:31 PM.

  5. #5
    Registered User
    Join Date
    01-19-2011
    Location
    Metairie, LA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Countif and Using WildCard

    The data is for Payroll Pay periods. Most of the pay dates are Friday unless there was a holiday or something. I simply want to count how may employees get paid for each pay. period unless they are 300 and under then I have to total the gross pay for everybody is 300 and below. I then have to break out that by each state and I haven't gotten to that part yet. So maybe Count if is not the exact command I need. Any ideals?

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Countif and Using WildCard

    COUNTIFS() and SUMIFS() would be the correct functions for your needs.
    Here are links to help you understand how they work.

    http://www.excelfunctions.net/Excel-...-Function.html

    http://www.excelfunctions.net/Excel-...-Function.html

  7. #7
    Registered User
    Join Date
    01-19-2011
    Location
    Metairie, LA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Countif and Using WildCard

    Thanks, I cleaning up my spreadsheet and will go from there. Originally I had to run off for the day and though I get the formula I need but I think I can make it easier.

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Countif and Using WildCard

    Try this workbook.

    There are two possible solutions, one if you need the workbook to run on pre-2007 versions of Excel, "Form (2003)"
    This uses SUMPRODUCT for the calculations.

    If you are confident that the workbook will only need to run in 2007, or later, use "Form (2007)".
    This uses COUNTIFS for the calculations and is much more economic on memory than SUMPRODUCT.

    In both cases Columns I:J are for prooving purposes and can be deleted.

    The department codes in sheet "Data" have a few anomalies e.g. 04 LA in some cases has extra spaces, and LA 04 seems to be at odds with the rest.
    The formulae I have used allows for this and treats them as one code.

    In Sheet "Data" column G seems to be redundant, all the values can be in column F.
    I have combined these columns, but in case you need a visual check I have put a formula in column G.

    With either "Form (2003)" or "Form (2007)"
    1/. To change the year select from the drop-down in A1

    2/. Column D is the grand total for each week in the chosen year.

    3/. Columns E:G the headers are the search strings and the results are for each State for the chosen year.

    4/. The drop-down in L1 might be a useful option, this allows you to count by State or individual departments, again for the selected year.
    This might be where a problem could occur with the extra spaces in some of the codes.

    Best to trim the codes at source, and decide whether 04 LA is the same department as LA 04.

    Hope this helps.

+ 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