+ Reply to Thread
Results 1 to 22 of 22

Formula needed to give a % of yes's in one column depending on text in another

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Formula needed to give a % of yes's in one column depending on text in another

    Hello,

    I have spent a few hours trying different formulas and arrays to try and fix a spreadsheet.

    I have a list of names in one column and a list of yes/no in another column. I need to show a resulting % of yes's a certain name has given. For example:

    Dave Yes
    Stuart No
    Dave Yes
    Dave Yes
    Stuart No
    Dave No
    Stuart Yes
    Dave No
    Dave No

    So Dave answered yes 3 out of 6 times, so this should show 50% in a separate results cell.

    Other information: Each column is infinite as it will be added to throughout the course of a year, and the data entry is on a separate workbook.

    Any help would be appreciated, thanks in advance

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Please Login or Register  to view this content.
    I split the data into Name column A, Yes/No column B, Arrray formula where DAVE is in F3.

    You need to press ctrl shift and enter to commit the formula

    Cheers
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hi, and welcome to the forum

    See attached. It uses dynamic range names so just add names and Y/N as necessary. The formulae will adjust automatically.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: Formula needed to give a % of yes's in one column depending on text in another

    =COUNTIFS(A2:A10,D2,B2:B10,"yes")/COUNTIF(A2:A10,"dave")
    Try this one
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hi all, the OP is using XL 2003, so countifs isnt there.

  7. #7
    Registered User
    Join Date
    06-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    22

    Re: Formula needed to give a % of yes's in one column depending on text in another

    The solved file is attached.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hi all, thanks for the speed responses, it's my first time on this forum and I'm impressed!!

    nathansav is correct, I'm using 2003 (upgrade is imminent apparently) so I can't use COUNTIFS.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Quote Originally Posted by Mister S View Post
    Hi all, thanks for the speed responses, it's my first time on this forum and I'm impressed!!

    nathansav is correct, I'm using 2003 (upgrade is imminent apparently) so I can't use COUNTIFS.
    Hi,

    OK, missed the 2003 point.

    See revised attached.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hello again.

    Thanks Richard Buttery, I think I understand it, and I hadn't tried using the SUMPRODUCT before, but when I implemented it into my workbook I get an error.

    I have just edited the spreadsheet I'm working on (I've had to change headers etc) and I've attached it. As you can see, there are 2 workbooks, the 'Single page' is for data input and the 'Results' book is for...erm...Results ha ha!! You will notice I have worked out some of the questions, but I'm struggling on the % of yes's.
    Attached Files Attached Files

  11. #11
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hi,

    See attached. Note I've used range names rather than specific cell addresses. I'd be inclined to get into the habit of using names, preferably dynamic range names as here since you will simplify things a lot.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Thank you for that, it works, but it just looks like voodoo magic at the moment! I'm trying to understand it as I have to perform a similar formula in the cells on row 14 (on the 'Results' book) and I changed the cell string from D$4 to C$13 but I get a #DIV/0! error.

    Are the D4, E4 and F4 cells on the 'Results' book the only cells with formulas? I dont understand how it references the information in the columns on the 'Single page' book!

  13. #13
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hi,

    Yes, D4:F4 are the only formulae I added. I expected you to study them and apply the technique to any others.

    And that's why I suggested you should get into the habit of using range names, preferably dynamic range names where lists of data expand or contract so that you don't need to change the names since they change automatically.

    With Excel 2003 look in the 'Insert Name Define' window and you'll see reference to names like "Names" & "YN_4". These are dynamic names since they are defined with an OFFSET() function.

    It will pay you big dividends if you spend a little time exploring range names if you've never used them before.

  14. #14
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Excellent, that's the first time I've heard of dynamic range, so that's opened up a new world for me to play with. I've managed to have a little read up on it and I've created new ranges for the other info I need. Thanks for your help.

  15. #15
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Well done, that's what we like to hear about.

    It's always nice to know that someone has learned something new rather than just accepted a solution.

    The next step is to move past Excel 2003 and make use of new functions like SUMIFS() - plural

  16. #16
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    I would definately prefer to know how it's done, but after a stubborn couple of hours trying to work it out via Google, I thought I should ask!

    I think I'm due an upgrade! Thanks again for your help.

  17. #17
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hello again,

    Just a quick question regarding the formula you gave me yesterday:
    =SUMPRODUCT((names=D$3)*(YN_4="Yes"))/COUNTIF(names,D$3)

    I want to add a condition to it, for example: If x=1 then....(your formula). I have created the relevant dynamic name range and tried to amend it the formula with something like:
    =SUMPRODUCT(Info1=F$8,((names=D$3)*(YN_4="Yes"))/COUNTIF(names,D$3)) - where F$8 = Purple

    But it's giving me a 0% no matter what the input. I've tried using an IF statement too, but that just gave me an error!
    Last edited by Mister S; 07-17-2014 at 05:28 AM.

  18. #18
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hi,

    Note that the SUMPRODUCT() consists of pairs of brackets (each containing a comparison) which are multiplied. Yours doesn't.

    It may be that

    Please Login or Register  to view this content.
    will work but without seeing the actual workbook it's difficult to be absolutely sure.

  19. #19
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    I think that's what's confusing me is that it's multiplied but it shouldn't be as it's finding a % of something within something else.

    I've re-attached the workbook, with your amended formula. It's giving me a result of 33% but it should be 100%.

    This is what I'm trying to do:
    What is the % of Dave(name) saying Yes(info4) when he's Purple(info1)!

    So at the moment there is only one entry that matches, and it is currently 'yes', so it should be 100%. If I added another entry of 'Purple - Dave - No', then the result should change to 50%.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Anyone got a clue on this?

    As above, I need to find % of Dave(name) saying Yes(info4) when he's Purple(info1)

    Mr Buttrey has kindly given me the following formula to give me the % of Dave saying Yes, which is placed in the results section:
    =SUMPRODUCT((names=C$9)*(YN_4="Yes"))/COUNTIF(names,C$9)

    Which coincides with the Dynamic Name range:
    'names' =OFFSET('Single page'!$F$2,0,0,COUNTA('Single page'!$F:$F),1)
    'YN_4' =OFFSET('Single page'!$J$2,0,0,COUNTA('Single page'!$J:$J),1)

    It's the first time I've used Dynamic Name ranges, so I'm trying to get to grips with it, but now I want to add the 'when he's purple' part to it and I'm struggling!

    Any help would be greatly appreciated.

  21. #21
    Registered User
    Join Date
    06-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    22

    Re: Formula needed to give a % of yes's in one column depending on text in another

    first tell me was my method wrong? wat diffiiculty did u face using my method??

  22. #22
    Registered User
    Join Date
    07-16-2014
    Location
    Southend on Sea, England
    MS-Off Ver
    2003
    Posts
    11

    Re: Formula needed to give a % of yes's in one column depending on text in another

    Hi Vikaskamble87, you used the COUNTIFS formula which I do not have as I am running Excel 2003.
    Last edited by Mister S; 07-23-2014 at 11:47 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. Text to column feature does not give the results as needed.
    By chandannasta in forum Excel General
    Replies: 1
    Last Post: 05-01-2014, 06:37 PM
  2. Replies: 2
    Last Post: 04-16-2014, 05:13 PM
  3. cell B will automatically show a text depending on the text on column A
    By Elainefish in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-05-2013, 05:57 AM
  4. Replies: 4
    Last Post: 12-20-2012, 04:33 AM
  5. Replies: 7
    Last Post: 10-31-2010, 03:32 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