+ Reply to Thread
Results 1 to 8 of 8

Formula to capture one or multiple Values > 20%

  1. #1
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Formula to capture one or multiple Values > 20%

    Hello, looking for assistance on a formula that will capture one or more values that meet certain criteria, in this case those that are greater than 20%, so that I can then incorporate into a concatenate statement. In this example, I have a table that shows varied percentages, and in one category (called "High"), need to "write out" those that are above 20% in the High category.

    Initially I was using a concatenate statement that included the REPT function, however it was not working 100%, so looking for added suggestions. The attached lists a sample with 10 'grades' and three of which are greater than 20% under the High category. This needs to be in a statement in preparation for a written analysis of the data.

    In the attached, I need a concatenate statement to first state "The grade(s) above 20% <are/is> ".... and then have ability to select one or more above 20%, which are the 3, 8, and 9 grades.

    As always, appreciate any assistance, thank you,
    Sheryl
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Formula to capture one or multiple Values > 20%

    Your best way to achieve this is with a UDF.

    Please Login or Register  to view this content.
    How to install your new code
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Press Alt+F11 to open the Visual Basic Editor
    Choose Insert > Module
    Edit > Paste the macro into the module that appeared
    Close the VBEditor
    Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
    [B][I]

    Then:
    ="The grade"&IF(COUNTIF(D:D,">0.2")>1,"s","")&" above 20% in the High Category "&IF(COUNTIF(D:D,">0.2")>1,"are ","is ")&ConcatAll(IF(D3:D12>0.2,$B$3:$B$12,""),", ")

    This is an array formula.

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    06-21-2017
    Location
    Missouri, USA
    MS-Off Ver
    2007 through 2019
    Posts
    71

    Re: Formula to capture one or multiple Values > 20%

    I got pretty close without any code, but I had to add a helper in column G and didn't end up with an "and" between the numbers. Maybe someone can work out how to find the last comma and replace with "and"...
    G3 Formula carried down =G2&IF(D3>0.2,B3&", ","")
    Statement Formula ="The "&IF(COUNTIF(D3:D12,">20%")=1,"grade","grades")&" above 20% in the High category "&IF(COUNTIF(D3:D12,">20%")=1,"is","are")&" "&LEFT(G12,LEN(G12)-2)
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Formula to capture one or multiple Values > 20%

    I fiddled with a helper column, but couldn't get one to work. Yours does. Here's the last bit:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-21-2017
    Location
    Missouri, USA
    MS-Off Ver
    2007 through 2019
    Posts
    71

    Re: Formula to capture one or multiple Values > 20%

    Awesome!
    Now if we wrap it in an IFERROR it could work when no entries meet the criteria, output "There are no grades above 20% in the High category."

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Formula to capture one or multiple Values > 20%

    Indeed, we could. Since it's 99% your effort, I'll leave that to you....

  7. #7
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Re: Formula to capture one or multiple Values > 20%

    Wow, thank you for the responses, will take a look through today and respond as soon as possible. Thanks!!

  8. #8
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Re: Formula to capture one or multiple Values > 20%

    This works great! Thank you !!!!!

    Sheryl

+ 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. [SOLVED] Formula to capture multiple Max Values
    By sherylt13 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-27-2019, 07:22 PM
  2. Formula to capture multiple values
    By ensmith in forum Excel General
    Replies: 7
    Last Post: 07-20-2017, 03:20 PM
  3. [SOLVED] Capture multiple highest row values and column headers
    By quart in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-27-2017, 04:51 PM
  4. [SOLVED] Formula to Capture Multiple Values for one Identifier
    By sherylt13 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-10-2015, 04:21 PM
  5. Replies: 17
    Last Post: 11-30-2009, 05:21 PM
  6. [SOLVED] 'IF' FORMULA TO CAPTURE CERTAIN CELL VALUES
    By PaulH-Oz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2006, 08:25 PM
  7. [SOLVED] RE: 'IF' FORMULA TO CAPTURE CERTAIN CELL VALUES
    By JMB in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-26-2006, 06:55 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