+ Reply to Thread
Results 1 to 6 of 6

Counting nonempyt cells in several rows - schedule

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    Kielce
    MS-Off Ver
    Excel 2007
    Posts
    4

    Counting nonempyt cells in several rows - schedule

    Hi guys,

    HELP needed here...:

    I created something like a work schedule for 8 people with shifts pattern.
    In the rows there are names and later are cells with days or nights or emty ones.
    The sequence gets repeated every two weeks for the whole period of the year.

    I would like to engage Excel to count non-empty cells for the period of whole year so I know how many shifts particular guys worked.

    In Google Docs I found this formula to be working. This is for one month for one person:
    =IF( ISNA(ROWS(QUERY($A$22:$M$399,ʺselect A where month(A)=ʺ & B$3 & ʺ and ʺ & $O4))),0,ROWS(QUERY($A$22:$M$399,ʺselect A where month(A)=ʺ & B$3 & ʺ and ʺ & $O4)))

    Couold you help me with the one for excel?

    Thanks in advance - regards
    Last edited by marteau; 04-25-2013 at 11:03 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Counting nonempyt cells in several rows - schedule

    Hi and welcome to the forum

    =countA() will count all non-blank cells
    =countif() will count all cells that match 1 criteria
    =countifS() will count all cells that match multiple criteria

    Try them and see how you make out.

    If you still have a problem, i would suggest you upload a sample work book, (all sensitive data removed), showing what data you are working with, a few examples of what your expected outcome is, and how you arrived at that
    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    Kielce
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting nonempyt cells in several rows - schedule

    Thanks for your reply.
    =countA() would do the job, but as you can see in the attached document I need to count from a different rows, which makes it a little bit more difficult...
    In Sheet 2 you can find where I would like to have the outcome of the operation.

    I really appreciate your help in this topic.

    Best regards.
    Attached Files Attached Files

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Counting nonempyt cells in several rows - schedule

    looking at your file, I notice that sometimes you have this...
    =IF(OR((COUNTIF(D3:D14, "D")<>2),( COUNTIF(D3:D14, "N")<>2),( COUNTIF(D3:D14, "OC")<>1),( COUNTIF(D3:D14, "DS")<>0),( COUNTIF(D3:D14, "DF")<>0)), "ERROR", IF((C2="ERROR"),( B2+2),( C2+1)))

    and other times, in the same situation, it changes to this...
    =IF(OR((COUNTIF(D3:D14, "D")<>2),( COUNTIF(D3:D14, "N")<>2),( COUNTIF(D3:D14, "OC")<>1),( COUNTIF(D3:D14, "DS")<>2),( COUNTIF(D3:D14, "DF")<>0)), "ERROR", IF((C2="ERROR"),( B2+2),( C2+1)))

    What is the reason for this?
    Another question is...why such a complex formula when you could just use...
    =C2+1
    or a shorter countifS()...=IF(COUNTIFS(D3:D14, "D<>2",D3:D14,"N<>2",D3:D14,"OC<>1",D3:D14,"DS<>0",D3:D14,"DF<>0"), "ERROR", IF(C2="ERROR", B2+2, C2+1))...Avoid unnecessary ()

    Also, I am looking at changing the format of what you have, so that your dates go down and the employees go agross. Its been my experience that it is always better to build a table that grows down, rather than across.

  5. #5
    Registered User
    Join Date
    04-25-2013
    Location
    Kielce
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting nonempyt cells in several rows - schedule

    In this schedule are going to be also DayShifts only guys, which have not been included in this file.
    DS on the week days and no DS on weekends...
    That's why this COUNTIF(D3:D14, "DS")<>2 or COUNTIF(D3:D14, "DS")<>0 are in use

    I will still have to work on automated date going down...

    Having this kind of setup lets me and the guys to print out easily having 6 weeks (3 horizontals).

    Any idea for improving of this document is more than welcome

    But the most important for me is Sheet2 and counting the shifts.
    DO you think that would be a possible to count DS as well?

    D and N are different hours than DS, so would be good to have this as well....

    I have uploaded also schedule with DS just to display the idea.

    Thanks in advance
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-25-2013
    Location
    Kielce
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting nonempyt cells in several rows - schedule

    Do you think guys that it would be possible to create this formulas to count the 12h shifts (D and N) and 8h day-shifts (DS) per months for a year?

+ 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