+ Reply to Thread
Results 1 to 7 of 7

Search bottom to top of a column to displaying all results that match a criteria

  1. #1
    Registered User
    Join Date
    11-14-2022
    Location
    England
    MS-Off Ver
    MS365 (PC) Version 2308
    Posts
    59

    Question Search bottom to top of a column to displaying all results that match a criteria

    Hello all, this problem has been bothering me for days so I’m really hopeful someone here can help. (I’ve attached a sample workbook with additional notes)

    In a nutshell I’m looking to search a list of invoice numbers in Column B for any that have the “ - Finished “ flag on them. However where it gets too hard for me is the fact I’m looking to do this search from the bottom of column B to the top of column B and return all the results that have the “ - Finished “ flag.

    Quick data without the sample workbook.
    982
    145
    353 - Finished 23/08/22
    876
    904
    123 - Finished 01/08/22
    353
    991
    402
    321 - Finished 18/07/22
    678
    609
    297 - Finished 30/07/22
    558

    Result desired (note these are not in date order but merely results taken from the bottom of the column up to the top of the column, when the “ - Finished “ flag is present)
    297 - Finished 30/07/22
    321 - Finished 18/07/22
    123 - Finished 01/08/22
    353 - Finished 23/08/22
    Attached Files Attached Files

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Search bottom to top of a column to displaying all results that match a criteria

    Well the problem is that the date information you want to sort off of is only inside the end of a text string, so in order to sort, you'll have to pull that out, parse into date, and then repackage.

    If you're getting the data populated by a dump from some external data, what's your appetite to change that macro so it populates a table with POV-xxx, Start_Date, and Finish_Date? Then you could just use regular sort/filter to filter out blank Finish_Date and sort any way you want without having to mess with formula.
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  3. #3
    Registered User
    Join Date
    11-14-2022
    Location
    England
    MS-Off Ver
    MS365 (PC) Version 2308
    Posts
    59

    Re: Search bottom to top of a column to displaying all results that match a criteria

    Thanks for the reply ben_hensel. I understand what you are saying but I’m not actually looking to sort via date.

    I just want a unique or filter or index+match formula to search from the bottom of the column to the top of the column. (Instead of the default of top to bottom) I have seen other people use this formula =LOOKUP(2,1/(A2:A100=C2),B2:B100) but my issue with that is it only seems to populate one result and not display an array of all results for a given criteria.

  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 2406
    Posts
    44,662

    Re: Search bottom to top of a column to displaying all results that match a criteria

    One way:
    =LET(r,B2:B21,sr,SORTBY(r,ROW(r),-1),FILTER(sr,ISNUMBER(SEARCH("Finished",sr))))
    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

  5. #5
    Registered User
    Join Date
    11-14-2022
    Location
    England
    MS-Off Ver
    MS365 (PC) Version 2308
    Posts
    59

    Re: Search bottom to top of a column to displaying all results that match a criteria

    Thanks so much for the formula Glenn Kennedy, I’ll try it as soon as I can and will confirm back if it works. In the mean time do you mind explaining what it does and how, even briefly so I can expand or move ranges and still have this formula work? Thanks again.

    Also is there any reason for that the formula I’m about to write has my desired outcome on Google Sheets but not on excel? =Filter(SORT(B2:B,ROW(B2:B)*N(B2:B<>""),0),ISNUMBER(SEARCH(" - Finished ",SORT(B2:B,ROW(B2:B)*N(B2:B<>""),0))))

  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 2406
    Posts
    44,662

    Re: Search bottom to top of a column to displaying all results that match a criteria

    =LET(r,B2:B21,sr,SORTBY(r,ROW(r),-1),FILTER(sr,ISNUMBER(SEARCH("Finished",sr))))

    Red - defines r as being the range.
    Orange - defines sr as the rows sorted by row number (in descending order - the -1)
    Green: returns the rows that contain the word "finished"
    Black filters sr, only returning those rows that contain "Finished".

    To change the range, you only need to change the B2:b21 bit.

    Re GS> Never used them, but Excel does not accept B2:B as a valid range. It needs a defined start and end point. B2:B21 HAS a defined end point.


    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  7. #7
    Registered User
    Join Date
    11-14-2022
    Location
    England
    MS-Off Ver
    MS365 (PC) Version 2308
    Posts
    59

    Thumbs up Re: Search bottom to top of a column to displaying all results that match a criteria

    Wow Glenn Kennedy, I'm not sure a thank you is enough because you are actually a hero. I have been searching for this for so long and what you wrote works like a charm, plus you solved it in under 1 day so I'm truly in awe of you excel skills. Thanks again for helping me. (Also cheers for the added comment about Google Sheets)

    Thanks also for the description of reputation and marking a thread as solved, I was very keen to do both because your solution helped me so much. I have therefore just added some reputation for your unbelievably amazing solution and have also marked the thread as solved. I honestly appreciate your time so thank you very much.
    Last edited by EricDonk; 11-15-2022 at 03:56 PM.

+ 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] using ISNUMBER(SEARCH()) with a list and displaying the results.
    By Mat87 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-19-2017, 01:09 PM
  2. [SOLVED] Search for Text and displaying the results
    By ymaster44 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2014, 12:20 PM
  3. Macro, to match criteria in one column and copies results into a new tab
    By masond3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2013, 08:57 AM
  4. [SOLVED] Search for Identifier in Column (different sheet) and Displaying Results in Specific Cells
    By Velocir in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2013, 11:37 AM
  5. [SOLVED] Finding and Displaying data results from search criteria
    By winlam in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-25-2012, 11:25 PM
  6. displaying search results after searching 2 cbo's
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2010, 08:19 AM
  7. Displaying Search results (filtering?)
    By Klok in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-04-2009, 06:45 AM

Tags for this Thread

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