+ Reply to Thread
Results 1 to 12 of 12

Help coming up with a Function to count number of cells containing text "yes"

  1. #1
    Registered User
    Join Date
    01-31-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    19

    Help coming up with a Function to count number of cells containing text "yes"

    Hi everyone,

    I am trying to figure out a function that will do the following:

    I have six(6) sheets. The first five(5) represent day of the week (Monday, Tuesday...) and the last sheet has the week totals. In each sheet, cell I5 will have either "Yes" or "No" text that was entered by the user. On the last sheets I5, I am looking to total up the number of "Yes" responses from the other 5 sheets. 

    Please note, the I5 cells in sheets 1-5 have a drop down menu that allows the user to select "yes" or "no". I originally wanted to use the COUNTIF function to do this but it seems like having the drop down validation on the cells doesn't allow the COUNTIF function to count the number of "yes".

    So for example the function would work like this: if the user selects "yes" on Monday and Wedndesday sheets, the last sheets I5 cell will have "2" in the cell.

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

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Hi Rosadocc,

    So for example the function would work like this: if the user selects "yes" on Monday and Wedndesday sheets, the last sheets I5 cell will have "2" in the cell.
    Below formula will help you to get the count of "yes" where you need to replace the sheet names with your sheet names i.e., Monday, Tuesday etc.

    =(Sheet3!A1="yes")+(Sheet2!A1="yes")+(Sheet1!A1="yes")

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    01-31-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Help coming up with a Function to count number of cells containing text "yes"

    I'm not sure if that is what I am looking for. Each sheet's I5 cell will have either a yes or a no value. On the last sheet I am simply looking for a function that will calculate how many "yes" values the other sheets had.

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

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Hi Rosadocc,

    This is what formula will do.. it will check each sheets (Monday, Tuesday etc..) for "yes' in I5 and will provide the result.. but yes, you need to modify the formula as I mentioned in my previous post... so the revised formula willl look like :-

    =(Monday!I5="yes")+(Tuesday!I5="yes")+(wednesday!I5="yes").......


    I have check this and formula is giving correct results.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Why don't you use one sheet?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Also, relative to your first post, it has nothing to do with dropdowns. CountIf doesn't work across multiple sheets like that unfortunately. dilipandey's solution will work for you.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

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

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Thanks chemistB for seconding me... cheers

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  8. #8
    Registered User
    Join Date
    01-31-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Yes I see I made a mistake on changing the name of my sheets. Your function works great thanks!. One more question if you could please help me out. Is there a way I can take this formula and add a function to leave that cell blank if all responses are "no"?

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Unfortunately, with Excel 2003, there are no shortcuts, the formula would be

    =IF((Monday!I5="yes")+(Tuesday!I5="yes")+(wednesday!I5="yes")....... =0,"",(Monday!I5="yes")+(Tuesday!I5="yes")+(wednesday!I5="yes")....... )

  10. #10
    Registered User
    Join Date
    01-31-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Help coming up with a Function to count number of cells containing text "yes"

    I have Excel 2010. Would this make it any different? Thanks in advance.

  11. #11
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Actually, in rethinking, since no error is generated when there are no "Yes's" there is no difference. You could format the cell(s) to not show 0
    Format Cell> Number > Custom
    Type in General;-General;
    The zero is still there, you just can't see it in the cell (you will see it in the formula bar).
    Does that work for you?
    Last edited by ChemistB; 04-25-2012 at 01:46 PM.

  12. #12
    Registered User
    Join Date
    01-31-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Help coming up with a Function to count number of cells containing text "yes"

    Its okay, this formula is good enough. THANKS!

+ 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