+ Reply to Thread
Results 1 to 6 of 6

get an INDEX/SORT/SEQUENCE to only display rows with actual non-zero numbers and no errors

  1. #1
    Registered User
    Join Date
    01-05-2021
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    4

    get an INDEX/SORT/SEQUENCE to only display rows with actual non-zero numbers and no errors

    Does anyone know how I can get these kinds of formulas to not return any error values (like #VALUE! or #DIV/0!) or any zero values and instead only return rows that have actual non-zero numbers in the 7th column?

    =INDEX(SORT('Sheet1'!A3:P356,7,-1),SEQUENCE(10),SEQUENCE(1,9))
    =INDEX(SORT('Sheet1'!A3:P356,7,1),SEQUENCE(10),SEQUENCE(1,9))

    Thank you very much in advance!

  2. #2
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,292

    Re: get an INDEX/SORT/SEQUENCE to only display rows with actual non-zero numbers and no er

    Yes, of course we do!

    Try this:

    =IFERROR(INDEX(SORT('Sheet1'!A3:P356,7,-1),SEQUENCE(10),SEQUENCE(1,9)),"")
    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.

  3. #3
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: get an INDEX/SORT/SEQUENCE to only display rows with actual non-zero numbers and no er

    You're sorting on the 7th column in ascending and descending order, and you seem to want 10-row by 9-column arrays of the top-left-most non-error cells in those sorted blocks.

    The trick would be shifting non-error values from outside the 10x9 grid into the 10x9 grid to replace error values.

    Presumably you want to do this by rows. That is, if your data were

    101 #VALUE! 103
    #DIV/0! 202 203
    301 302 303

    and you wanted a 2-row by 2-column table, your expected result should be

    101 103
    202 203

    rather than

    101 202
    301 302

    Also, do you always want the 7th column AS the 7th column? Could it ever contain error values? If, say, in some row columns A-E and G-P were non-error values, you'd want that row in the result to be from columns A, B, C, D, E, H, G, I, J in that order?

    Would you want to skip rows with fewer than 9 non-error values?

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: get an INDEX/SORT/SEQUENCE to only display rows with actual non-zero numbers and no er

    If that's all that were needed, why not

    =IFERROR(INDEX(SORT(Sheet1!A3:I356,7,-1),SEQUENCE(10),0),"") ?

    IOW, why include columns J to P? Note: not screening out 0 values. To do that, if OP has the LET function,

    =LET(x,INDEX(SORT(Sheet1!A3:I356,7,-1),SEQUENCE(10),0),IFERROR(IF(AND(ISNUMBER(x),x=0),"",x),""))

  5. #5
    Registered User
    Join Date
    01-05-2021
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    4

    Re: get an INDEX/SORT/SEQUENCE to only display rows with actual non-zero numbers and no er

    I guess what I'm looking to do is pull only some rows from a large array, and pull those rows based on the top 10 and bottom 10 values from a certain column. And there are plenty of rows where there is no value in the column I'm looking at, as well as plenty of rows where that cell is one of the errors I described above. More or less just need a tab on a sheet that pulls only some of the array so I don't need to do the manual sorting. Does that make sense?

  6. #6
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: get an INDEX/SORT/SEQUENCE to only display rows with actual non-zero numbers and no er

    Doesn't help. It was already clear you wanted the top and bottom 10 rows based on the 7th column. It remains unclear what you want for each column in the result.

    Could the 7th/sort column ever have error values? This doesn't require a paragraph response, or even a sentence. One word, yes or no, would suffice. Indeed, any response other than one or the other of those 2 words wouldn't help at all. I ask because if that column could also contain error or 0 values, you'd need a FILTER call inside the SORT call. If there could be errors or 0s in the 7th column, presumably those rows should be excluded.

    Of the remaining rows, do you just want error and zero values to be replaced by empty strings, "", or do you want the 9 leftmost non-error, nonzero values from columns A to P on each row?

    If you just want the top and bottom 10 rows from Sheet1!A3:P356, that's easy enough to accomplish by selecting a 10-row by 16-column range and entering the ARRAY formula ([Ctrl]+[Shift]+[Enter])

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

    where x is either 1 or -1. Entering as a traditional array formula would constrain the result to the size of the range in which you enter the array formula. No need for INDEX and SEQUENCE.

    If you only want 9 columns, then no need to go out to column P. You should get that result selecting a 10-row by 9 column range and using the ARRAY formula

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

    again where x is either 1 or -1.

    If you want to use spill references like X99# to refer to the result ranges, then you would need spilled formulas. In which case

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

    again where x is either 1 or -1, and Y is a placeholder for whichever the rightmost column returned should be.

+ 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] Display selection in rows, columns and actual address
    By drgkt in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-06-2017, 02:52 PM
  2. Extract Rows where Numbers are not in Sequence
    By teco in forum Excel General
    Replies: 4
    Last Post: 01-26-2017, 09:53 AM
  3. Replies: 4
    Last Post: 12-17-2015, 12:33 AM
  4. Convert numbers appearing as a date into actual date in order to sort data
    By Santa1986 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-06-2015, 12:56 PM
  5. [SOLVED] Verify if two numbers in sequence (Rows)
    By elsg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-17-2014, 09:15 AM
  6. Sequence numbers based on date and independent of column sort order
    By bedepe in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-21-2014, 07:32 PM
  7. [SOLVED] How can I sort data in sequence by odd/even numbers
    By TxBlackJack in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-19-2006, 01:15 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