Consulting

Results 1 to 3 of 3

Thread: Calculate the percentage of those who answered YES

  1. #1
    VBAX Newbie
    Joined
    Mar 2016
    Posts
    2
    Location

    Calculate the percentage of those who answered YES

    Hi Everyone,


    I would like to seek for your help in getting the percentage of people who answered yes. Let's say on below table, 80% answered Yes. i would like also to know the breakdown of the respondents. Like how many (in perecentage) from the respondents came from US, germany, China etc.


    i would like to have a button to click then a message box will appear containing the percentages.




    Please help.


    Thanks,
    Mike
    Attached Images Attached Images

  2. #2
    VBAX Newbie
    Joined
    Mar 2016
    Posts
    2
    Location
    For calculating how many answers are yes you can just use an IF statement to see if Range("D?") = Yes then increment a counter variable each time it is true. Also increment a total variable each time regardless. Then CounterYes / CounterTotal * 100 = YesPct.

    Will this always have the same number of entries or will it vary? I.e. always 10 names or sometimes 12 or 15 or w/e?

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    I suggest using a pivot table, much easier and more flexible

    Capture.JPG
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •