+ Reply to Thread
Results 1 to 12 of 12

Help With A Formula To Sort Numbers And Percentages

  1. #1
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Help With A Formula To Sort Numbers And Percentages

    Greetings Forum Members,
    I have an organized group of data that is broken down into several columns with a main heading highlighted green and sub headings of (#, %, P, P%, L, L%, B, B%, WP, WP%). I require a formula where I am able to enter a certain criteria that I am looking to find in the data set and the formula returns the column titles and values that meet that criteria. The search criteria will be entered into three columns the first finds the column for each grouping I want the formula to search for and the 2nd and 3rd criteria consist of finding numbers or percentages that are either <= or >= a number that I enter into the cell.

    See the attached spreadsheet for a better understanding. The values in the attached spreadsheet have been manually entered to give an example of what I want the result to be. Thank you for any help or advice.
    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 2406
    Posts
    44,662

    Re: Help With A Formula To Sort Numbers And Percentages

    Ha! One that didn't cause TOO much brain strain. Use variants of this array formula, as shown in the sheet:

    =IFERROR(INDEX(A:A,SMALL(IF(($B$3:$K$3=$AT$2)*ROW($B$4:$K$10)*($B$4:$K$10<=$AU$2),ROW($A$4:$A$10)),ROWS($AT$3:AT3)))&"","")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    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

  3. #3
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Help With A Formula To Sort Numbers And Percentages

    Hey Glen! Glad this one didn't cause as much brain strain lol! I appreciate the help. The formula works the way I needed but it only encompasses the "<=" in AU2. I also needed it to encompass the ">=" cell in AV2. Any further help would be appreciated. Thank you again.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,691

    Re: Help With A Formula To Sort Numbers And Percentages

    Maybe you just need to add another clause:

    =IFERROR(INDEX(A:A,SMALL(IF(($B$3:$K$3=$AT$2)*ROW($B$4:$K$10)*($B$4:$K$10<=$AU$2)*($B$4:$K$10>=$AV$2),ROW($A$4:$A$10)),ROWS($AT$3:AT3)))&"","")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

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

    Re: Help With A Formula To Sort Numbers And Percentages

    How will that work? Will ONLY one of the two cells (AU2 and AV2) be populated, or can BOTH be populated with a number?

  6. #6
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Question Re: Help With A Formula To Sort Numbers And Percentages

    Thank you Ali and Glenn for your help and thoughts on the matter. I decided to split the task into two formulas. Have one page that finds "<=" and another page that has ">=". The real issue I am trying to address is a way the formula can be done without the cells being locked so I can easily drag the formula column to column instead of having to edit the formula one by one. I need this because the actual data set is much larger so I need the setup to be less time consuming.

    I have attached a new spreadsheet with the larger data set with the sorting formula starting in column "OI". Also, I need a formula that list the headings starting "OI3".

    Thank you again both of you for the help.
    Attached Files Attached Files

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

    Re: Help With A Formula To Sort Numbers And Percentages

    There are now too many categories to to set up independent formulae. So the relatively simple formula is now a bit of a monster. It's done. The parameter choice and the >= and <= choices are now selected from DD boxes, to prevent extraneous spaces creeping in.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Help With A Formula To Sort Numbers And Percentages

    Thank you very much Glenn. That's exactly what I needed. It's greatly appreciated. I have one question though, how can I make changes to the sheet "DV" and the drop down cells. i didn't know something that was possible in Excel and want to learn how that was done. Thank you again.

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

    Re: Help With A Formula To Sort Numbers And Percentages

    I'm away till the UK morning. Look back here at breakfast coffee your time tomorrow.

  10. #10
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Help With A Formula To Sort Numbers And Percentages

    Ok. Thank you again Glenn very much. I would Give you more rep but it's saying I need to spread it around. You've helped me so much! Thank you again.

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

    Re: Help With A Formula To Sort Numbers And Percentages

    Named ranges are a bit like shorthand. They enable words to be used to describe a range of cells - some people prefer this to $A14:$A$14532 or whatever. Hit CTRL F3 to see the two Named Ranges in your file. I have given them the highly original names Range1 and Range2. NRs have the advantage that they can be made dynamic, allowing you to add/substract values and the rangfe automatically adjusts to suit. I didn't bother with that here, as the categories used seemed as though they didn't ned to be dynamic: <= and >= cover all the possibilities... so a simple formula to describe the Named range is fine =DV!$A$1:$A$2 However if you needed to add/subtract values from range2, then the DV formula should be edited to be:

    ='DV'!$B$1:INDEX('DV'!$B$1:$A$100,COUNTA('DV'!$B$1:$B$100))

    I've replaced Range2 with List which is dynamic. Add a few lines to column B. see what happens in OI2. Delete them. see what happens in OI2...
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    10-05-2010
    Location
    CA
    MS-Off Ver
    Excel 365
    Posts
    539

    Re: Help With A Formula To Sort Numbers And Percentages

    Thank you Glenn for all of the help and explaining that too me. Greatly appreciated.

+ 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 sort by numbers
    By rizmomin in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-09-2015, 09:59 AM
  2. [SOLVED] Formula problem, get and sort numbers between two values
    By Michaelice in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-04-2013, 03:36 AM
  3. Formula to create percentages based on words instead of numbers
    By stixmike in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-20-2012, 03:10 PM
  4. Formula for percentages / negative numbers
    By michlars in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-12-2009, 04:04 PM
  5. formula required to sort numbers as per given in sheet
    By kaustubhghag in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 12-22-2008, 02:01 AM
  6. Formula and percentages against user set numbers
    By unsub in forum Excel General
    Replies: 5
    Last Post: 12-09-2008, 05:54 AM
  7. How do I change numbers and percentages in a formula??
    By Jackie R. in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-28-2006, 01:25 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