+ Reply to Thread
Results 1 to 8 of 8

Counting a number only once if it appears multiple times.

  1. #1
    Registered User
    Join Date
    07-07-2022
    Location
    Roswell, NM
    MS-Off Ver
    Excel 365
    Posts
    3

    Counting a number only once if it appears multiple times.

    Hi there!
    I have a spreadsheet for a classroom. It is divided into the days of the week. Within those days, it is further divided into the meals we serve the children: Breakfast, Lunch, Snack. The teacher enters a "1" for every meal the child is present for, a "0" if the child is absent during that meal. The final column is where I am having an issue. This is the Average Daily Attendance column. It is not a total, nor an average (despite the title). I need a formula that will tell me if a child was there at all for any given day but will only count them once, even if they were there for all three meals. The maximum number to be counted is 5 because even if a child is present for all three meals, all five days, we only count them once for each day. I am attaching a sample for clarification. I need someone smarter than I to help!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2021
    Posts
    5,931

    Re: Counting a number only once if it appears multiple times.

    Try this in R5:

    =(COUNTIF(C5:E5,1)>0)+(COUNTIF(F5:H5,1)>0)+(COUNTIF(I5:K5,1)>0)+(COUNTIF(L5:N5,1)>0)+(COUNTIF(O5:Q5,1)>0)

    Or try:

    =SUMPRODUCT(--(COUNTIFS(OFFSET(B5,0,{1,4,7,10,13},1,3),1)>0))

  3. #3
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,498

    Re: Counting a number only once if it appears multiple times.

    Cell R5 formula , Drag down

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-07-2022
    Location
    Roswell, NM
    MS-Off Ver
    Excel 365
    Posts
    3

    Re: Counting a number only once if it appears multiple times.

    Thank you so much! This will save me a tremendous amount of time and effort.

  5. #5
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,498

    Re: Counting a number only once if it appears multiple times.

    @Leslielashawn You're Welcome. Glad to help . Thank You for the feedback.

    If you finally get a solution please mark your thread as SOLVED:
    - Click Thread Tools above your first post,you will see the word PREFIX on the upper left, press the button to select [SOLVED] select "Mark your thread as Solved".
    - Please click on the *Add Reputation button at the bottom left. Whoever helps you, give it to whoever you like

  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Counting a number only once if it appears multiple times.

    This is also a possibility for cell R5: =OR(C5,D5,E5)+OR(F5,G5,H5)+OR(I5,J5,K5)+OR(L5,M5,N5)+OR(O5,P5,Q5)

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,410

    Re: Counting a number only once if it appears multiple times.

    Drawing on HansDouwe's approach similarly in S5 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  8. #8
    Forum Contributor
    Join Date
    11-21-2013
    Location
    zimbabwe
    MS-Off Ver
    Excel 2003
    Posts
    124

    Re: Counting a number only once if it appears multiple times.

    Array formula in R5
    Please Login or Register  to view this content.
    Ctrl+Shift+Enter
    Last edited by soledad; 07-13-2022 at 05:31 AM.

+ 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] Counting if a word appears an odd number of times
    By hboss_1 in forum Excel General
    Replies: 8
    Last Post: 05-19-2021, 10:25 AM
  2. Counting number of times a value appears in a certain cell over multiple sheets
    By cdhampshire in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-22-2018, 08:33 AM
  3. [SOLVED] Counting number of times unique id appears
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-26-2012, 01:06 PM
  4. Replies: 3
    Last Post: 09-17-2012, 08:05 AM
  5. Replies: 3
    Last Post: 05-14-2012, 10:22 PM
  6. Counting the number of times a month appears
    By Kololo in forum Excel General
    Replies: 3
    Last Post: 02-24-2012, 10:29 PM
  7. Counting the number of times an entry appears
    By nickifan in forum Excel General
    Replies: 2
    Last Post: 11-22-2010, 12:04 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