+ Reply to Thread
Results 1 to 8 of 8

using vlookup (?) to calculate percentages

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    Maine
    MS-Off Ver
    Excel 2007
    Posts
    53

    using vlookup (?) to calculate percentages

    I need to write a formula that will do the following to the attached (simplified) worksheet.

    The formula needs to:

    Count all "N"s in column C that share a row with the "N"s in column A. Then I need to calculate the percentage of "N"s vs "A"s.

    For example, I have ten rows with "N" in column A. Nine of these rows have "N" in column C, so my formula would return "90%". One of these rows has an "A", so a second formula will return "10%"

    There will be many variations but if I can figure out the formula I can do the rest. I got as far as thinking I need to use vlookup and maybe a count function but have no idea how to set it up. Thanks in advance, someday I will be better and can start helping other people I promise!
    Attached Files Attached Files

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: using vlookup (?) to calculate percentages

    Like
    Please Login or Register  to view this content.
    perhaps? (same for "n")

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: using vlookup (?) to calculate percentages

    just FYI, a vlookup does just that...it finds (the 1st instance of) a value that you specify, in a range you define, and returns a value from the column you say....
    =VLOOKUP(what-you-want-to-find,range-to-search-in,column-that-contains-the-match,FALSE) FALSE is for finding an exact match
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    01-14-2013
    Location
    Maine
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: using vlookup (?) to calculate percentages

    no, but I might be able to use a nested COUNTIF? The formula I need will basically be taking a subset of the data. So it will find all rows with "N" in column A, and then the percentages of N vs A is calculated from column C (Only for rows which have "N" in column A)

    I will play around with the COUNTIF function though I think that is the right track.

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: using vlookup (?) to calculate percentages

    Have you tried my suggestion?

  6. #6
    Registered User
    Join Date
    01-14-2013
    Location
    Maine
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: using vlookup (?) to calculate percentages

    Yes Pepe, I am sorry, that is the suggestion I tried. That is only calculating the percentage of all N's and A's in column C which is not what I am looking for.

    Check out the example I gave in the OP. Another example would be, since there is one "G" in column A, and the corresponding value in column C is "A", then I would have two formulas that would say that for G, 100% of values are "A" and 0% are "N". The amounts of N's, G's and A's in column A change, thats why I need a formula to first count what is in column A and then evaluate column C for each value (in column A).

    Thanks for your help.

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: using vlookup (?) to calculate percentages

    Perhaps something like
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-14-2013
    Location
    Maine
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: using vlookup (?) to calculate percentages

    I think that works, I tried a couple different scenarios with it and they all seem to give the right answers.

    Thanks a bunch! Sorry If I did a bad job explaining what I needed.

+ 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