+ Reply to Thread
Results 1 to 12 of 12

data validation question

  1. #1
    Registered User
    Join Date
    05-31-2007
    Posts
    16

    data validation question (updated question)

    Hello,

    I'm new to Excel and I've just figured out how to use Data Validation to create these handy dropdown boxes, at any rate here is my question:

    Is there a formula that I can use that takes the information from a column (or row) that has data validation boxes w/ either a "yes" or "no" option and have it return the % of "yes" and "no" answers.

    I'm not sure if that makes any sense, but...if have a list of 72 items and in columns C1-C72 have the data validation boxes in them, and 40 are selected as "yes" and 32 are selected as "no", is there a formula I can use to have box C73 tell me the % of 'yes" answers and box C74 tell me the % of "no" answers.

    Any help would be greatly appreciated.

    Kind regards,
    Last edited by sous2817; 05-31-2007 at 10:03 PM. Reason: updated question

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =COUNTIF($C$1:$C$72,"yes")/COUNTA($C$1:$C$72)

    and

    =COUNTIF($C$1:$C$72,"no")/COUNTA($C$1:$C$72)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    05-31-2007
    Posts
    16
    Thanks! Works perfectly. I can't thank you enough for your help and quick response...

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You're welcome!

  5. #5
    Registered User
    Join Date
    05-31-2007
    Posts
    16

    New question

    Hello again,

    I'd like to make my spreadsheet a little more complex....

    Now that I can make a "yes" and "no" drop down box, and thanks to NBVC I have the formula I need, here is my next question:

    Is there any way to make the remainder of a row conditional on an earlier response. So, building on my previous example, in column C1-C72 the user has the option to choose either "yes" or "no". So let's say the heading of column C is "Do you like ice cream". The heading for column D is "What flavors". I don't want the user to be able to input any data in column D if they answered "no" in column C. That way I can figure out what % of people like ice cream and the % of what people prefered a specific flavor of ice cream and hopefully limit the chance that the user will put in data in the wrong field. Does that make any sense?

    Again, any help would be wonderful.

    Kind regards,

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You can use data validation for that too!

    select the range next to the range that has the yes/no dropdown.

    let's say as in your first example, this range is D1:D27.

    After selecting the range go to Data|Validation and choose Custom from the Allow menu. In the formula field enter: =C1="yes"

    where C1 is the top most cell in the yes/no range.

    Now if the user selects "no" in C1 and tries to type something in D2, he will get an error message.....

    Note: this error message is editable to your taste via the other tabs in the Data Validation dialogue box.

  7. #7
    Registered User
    Join Date
    05-31-2007
    Posts
    16
    NBVC, you're my Excel hero! Thank you again! Two last questions...well until I think of the next one.

    First, if a person enters "yes" in cell C1 (which will allow input in D1), can I make D1 a drop down box as well, or am i only allowed 1 data validation per cell. It would be very helpful if I could make C1 a dropdown "yes or no" and then let D1 be a dropdown box be "strawberry, rocky road, other" (i don't want them to be able to put in Mint)...see what I mean?

    Second, the spreadsheet I'm creating will have varied data from month to month (I'm making a spreadsheet to track if cancer patients go on a clinical trial or not). The number of patients the office sees varies from month to month. What'd I'd like is the totals to be on the last line on the sheet and what I'd like to avoid is 'X' amount of blank lines before getting to the totals. For instance:

    In January we saw 50 patients and 15 of them went on a clinical trial. So, I can use your handy formula on lines 51 and 52. If in Feb the office sees 30 patients, I'd rather not have 20 blank lines before it gets to the totals. March we saw 65 patients, I'd rather not reformat that spreadsheet from month to month.

    Does what I'm asking make sense? Is it possible?
    Last edited by sous2817; 05-31-2007 at 10:34 PM.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Without getting into some VBA macros to find the last row and insert formula, you can't do that too easily.

    My suggestion would be to insert a row at the top of the sheet and place the formulas there that will summarize your data.


    My previous formula(s) could be ammended to consider entire columns,

    e.g. =COUNTIF($C:$C,"yes")/COUNTA($C:$C)

    will count all yeses in column C and divided by number of cells containing any values in column C.... you would just subtract, from the divisor, the number of rows at top that contain headings, etc. so that you only account for the rows containing yes or no entries.

  9. #9
    Registered User
    Join Date
    05-31-2007
    Posts
    16
    Thanks again NBVC, that makes sense. Just keep all the formulas in the top of the sheet...I should have thought of that...I was busy editing my previous post adding another question. I'm not sure if you saw it, so I'll repost it here:

    if a person enters "yes" in cell C1 (which will allow input in D1), can I make D1 a drop down box as well, or am i only allowed 1 data validation per cell. It would be very helpful if I could make C1 a dropdown "yes or no" and then let D1 be a dropdown box be "strawberry, rocky road, other" (i don't want them to be able to put in Mint)...see what I mean?

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    yes, you can do that


    First create the list somewhere in the spreadsheet in a single column.

    Then select that list and go to Insert|Name|Define and in the field at the top (names in workbood) enter the word "yes" (without quotes). Click OK

    Now select any blank cell (that won't ever be used) and repeat the naming process above calling that cell "no"....again no quotes.

    Now select D1 (cell next to your yes/no dropdown) and go to Data|Validation and select List. In the source field enter formula: =INDIRECT(C1) and click Ok.

    Now, when user selects yes in C1, he gets a list of flavours in D1. If he selects no in C1, he gets a blank list.

  11. #11
    Registered User
    Join Date
    05-31-2007
    Posts
    16
    Oh wow! This is the coolest spreadsheet I've ever made...I can't thank you enough for all your help! I better hit the hay...I've got a lot of formatting to do tomorrow. I'm sure I'll be back w/ a few more questions, I hope you won't mind me picking your brain again...

    Kind regards,

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    No problem.

    Good Night and Good luck.

+ 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