+ Reply to Thread
Results 1 to 10 of 10

How to calculate the number of days present using formula?

  1. #1
    Registered User
    Join Date
    01-02-2012
    Location
    Karnatak, India
    MS-Off Ver
    Excel 2010
    Posts
    34

    How to calculate the number of days present using formula?

    In below data: Out of 6 working days John was present for 3 days.

    So how to get the answer 3, using formula? Can someone please help me. Thanks

    NOTE: JOHN is attending the class twice in a day! 1st class in morning and 2nd class in evening.

    Monday John
    Monday John
    Monday Tim
    Tuesday John
    Tuesday David
    Wednesday David
    Thursday Smith
    Friday Smith
    Saturday John
    Last edited by rajeshntiwari; 01-14-2015 at 07:38 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Attendance

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Ben Van Johnson

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Attendance

    Remove duplicates and then use a COUNTIF formula:

    Row\Col
    A
    B
    1
    Monday John
    2
    Monday Tim
    3
    Tuesday John
    4
    Tuesday David
    5
    Wednesday David
    6
    Thursday Smith
    7
    Friday Smith
    8
    Saturday John
    Last edited by shg; 01-14-2015 at 07:49 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    11-12-2014
    Location
    California
    MS-Off Ver
    2013
    Posts
    5

    Re: Attendance

    With duplicates removed, something such as this would work:

    =COUNTIF(B2:B8,"John")

  5. #5
    Registered User
    Join Date
    01-02-2012
    Location
    Karnatak, India
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Attendance

    @protonLeah

    Sorry about that! I have made the changes. Thanks

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to calculate the number of days present using formula?

    Use this formula to get unique names in C2 and copy down

    =IFERROR(INDEX($B$2:$B$10,MATCH(0,INDEX(COUNTIF(C$1:C1,$B$2:$B$10),,),)),"")

    and to count

    in D2 and copy down

    =SUMPRODUCT((B$2:B$10=C2)/COUNTIFS(A$2:A$10,A$2:A$10,B$2:B$10,B$2:B$10))

    Row\Col
    A
    B
    C
    D
    1
    Day Name Unique Name Count
    2
    Monday John John
    3
    3
    Monday John Tim
    1
    4
    Monday Tim David
    2
    5
    Tuesday John Smith
    2
    6
    Tuesday David
    7
    Wednesday David
    8
    Thursday Smith
    9
    Friday Smith
    10
    Saturday John
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to calculate the number of days present using formula?

    Here's one way...

    Data Range
    A
    B
    C
    D
    E
    1
    Weekday
    Student
    ------
    Student
    Count
    2
    Monday
    John
    John
    3
    3
    Monday
    John
    4
    Monday
    Tim
    5
    Tuesday
    John
    6
    Tuesday
    David
    7
    Wednesday
    David
    8
    Thursday
    Smith
    9
    Friday
    Smith
    10
    Saturday
    John


    This array formula** entered in E2:

    =SUM(IF(FREQUENCY(IF(B2:B10=D2,MATCH(A2:A10,A2:A10,0)),ROW(A2:A10)-ROW(A2)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Registered User
    Join Date
    01-02-2012
    Location
    Karnatak, India
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: How to calculate the number of days present using formula?

    @Alkey @Tony Valko

    Both the formulas are working perfect! Thank you so much for your time

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to calculate the number of days present using formula?

    You're welcome. We appreciate the feedback!

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How to calculate the number of days present using formula?

    Given that there are are a finite number of days possible you could turn this around a little and use this non-array formula in E2 (assuming Tony's suggested setup)

    =SUM((COUNTIFS(B:B,D2,A:A,TEXT({1,2,3,4,5,6,7},"dddd"))>0)+0)
    Audere est facere

+ 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. Replies: 10
    Last Post: 03-17-2016, 05:34 AM
  2. attendance log
    By excellionaire in forum Excel General
    Replies: 20
    Last Post: 08-16-2011, 02:48 PM
  3. Replies: 3
    Last Post: 06-12-2011, 02:56 PM
  4. Attendance Log
    By mwilburn01 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-14-2010, 11:31 AM
  5. Attendance
    By praveen_khm in forum Excel General
    Replies: 2
    Last Post: 02-02-2006, 04:16 PM

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