+ Reply to Thread
Results 1 to 7 of 7

Finding all the non empty rows in a column depending on user input in custom order.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-06-2020
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    113

    Finding all the non empty rows in a column depending on user input in custom order.

    I have user input in col B2 and output from A14 (containing formula) . I have managed to extract empty rows based on user input (doesnt work if country name repeats and adjacent rows are empty) . I want to sort the data in a order . My expected output is from E14.
    Attached Files Attached Files

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Finding all the non empty rows in a column depending on user input in custom order.

    ...I want to sort the data in a order
    which is ?

    you don't stipulate how you arrived at your expected results -- so, we can guess Z-A, 0-9 but that may just be coincidence given sample results.

    also, can you confirm you're using XL2007, and not XL2010 or later?

  3. #3
    Forum Contributor
    Join Date
    03-06-2020
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    113

    Re: Finding all the non empty rows in a column depending on user input in custom order.

    Sort should be according to country (custom sort - first country is russia so all russia if condition is met then french japan n so on ) as shown in expected results E 14 . The output is based on date ( B 2).

    The formula i used cell ( A 14 ) gives me non blank rows but not in an order and if country is repeated ( china in this case the result is 0 0 in adjacent cells ) .

    Version -2007
    Last edited by thebeastslayer; 06-15-2020 at 06:28 AM.

  4. #4
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Finding all the non empty rows in a column depending on user input in custom order.

    By "custom sort" I'm assuming you actually mean, return all records for given country in the order in which that country first appears in the list

    If so, given XL2007, I would advise following:

    Formula: copy to clipboard
    D13: "some text"
    D14: =IF($D13="","",IFERROR(MOD(SMALL(INDEX(MATCH($G$3:$G$11&" ",$G$3:$G$11&" ",0)*10^7+ROW($G$3:$G$11)+9.99E+307*(N(+INDEX($J$3:$V$11,0,MATCH($B$2,$J$1:$V$1,0)))=0),0),ROWS(D$14:D14)),10^6),""))
    copied down
    modify ranges to suit
    then
    A14: =IF($D14="","",INDEX($G:$G,$D14))
    B14: =IF($D14="","",INDEX(J:V,$D14,MATCH($B$2,$J$1:$V$1,0))) --> and copied to C14
    then copy down
    if you choose to not isolate the row # in D, once, you will end up repeating the same (potentially expensive calc) repeatedly, which is not a good idea.
    (this is also why we have a header in row D13 - such that we can test prior result, and cease once we know that all results have been returned)

    if the above doesn't generate the desired results in real-life, (i.e. it will replicate your expected results), post back with a more detailed sample - with multiple scenarios.

  5. #5
    Forum Contributor
    Join Date
    03-06-2020
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    113

    Re: Finding all the non empty rows in a column depending on user input in custom order.

    I have tried with few scenarios (works well) . I have one more query . I have added a total column in row E .I want to do the same sorting non blank (non - zero) with custom sort. My expected output in from A3 . Also when user input is russia i want only russia to appear removing others. When it is blank then all country shld appear will name . Assume user input is in cell B1 which is blank.
    Attached Files Attached Files
    Last edited by thebeastslayer; 06-15-2020 at 09:58 AM.

  6. #6
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Finding all the non empty rows in a column depending on user input in custom order.

    I'm taking a leap of faith that these results are to go into A3:Bx, in which case:

    Formula: copy to clipboard
    D2: "some text"
    D3: =IF($D2="","",IFERROR(MOD(SMALL(INDEX(MATCH($G$3:$G$11&" ",$G$3:$G$11&" ",0)*10^7+ROW($G$3:$G$11)+9.99E+307*SIGN((N(+$E$3:$E$11)=0)+(($G$3:$G$11<>$B$1)*($B$1<>""))),0),ROWS(D$3:D3)),10^6),""))
    copied down
    then
    A3: =IF($D3="","",INDEX(G:G,$D3))
    copied across matrix A3:Bx
    Last edited by XLent; 06-15-2020 at 12:21 PM. Reason: added D2 comment, just in case

  7. #7
    Forum Contributor
    Join Date
    03-06-2020
    Location
    INDIA
    MS-Off Ver
    2007
    Posts
    113

    Re: Finding all the non empty rows in a column depending on user input in custom order.

    Thank you . Works fine as of now.

+ 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] Finding all the non empty rows in a column depending on user input.
    By thebeastslayer in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-06-2020, 11:48 AM
  2. [SOLVED] Delete specific number of rows for each column with user input
    By Sriramroxx in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-22-2019, 11:28 AM
  3. [SOLVED] need a smarter formula depending on user input
    By lexusap in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2017, 12:16 AM
  4. Adding rows depending on user input
    By haitham1984 in forum Excel General
    Replies: 0
    Last Post: 11-10-2008, 07:30 AM
  5. Adding Rows depending on user input
    By haitham1984 in forum Excel General
    Replies: 0
    Last Post: 11-09-2008, 02:35 AM
  6. Adding rows and embedded formulas depending on user input
    By haitham1984 in forum Excel General
    Replies: 5
    Last Post: 11-06-2008, 11:04 AM
  7. Copy rows when column matches a user input from another workbook
    By cjc155 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-21-2008, 04:33 AM

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