+ Reply to Thread
Results 1 to 3 of 3

Remove [Variable] from a column using an Array?

Hybrid View

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    detroit, michigan
    MS-Off Ver
    Excel 2003
    Posts
    60

    Remove [Variable] from a column using an Array?

    Hey all,

    So, I'll make it snappy:

    If I've got the following column:

    Column A
    A1 - Red
    A2 - Blue
    A3 - Invalid
    A4 - Pink
    A5 - Invalid
    A6 - Orange

    Is there an array which can translate that information into Column B as such:

    Column B
    A1 - Red
    A2 - Blue
    A3 - Pink
    A4 - Orange
    A5 - ""
    A6 - ""

    Essentially, getting rid of the specified variable ("Invalid" in this case) and pushing all the other variables to the top?

    Previously, I was using this formula:

    =IFERROR(INDEX('Raw Data'!G:G,SMALL(IF(ISNUMBER(SEARCH("??*",'Raw Data'!G$3:G$20)),ROW('Raw Data'!G$3:G$20)),ROWS($4:14))),"")

    Where I had "1" rather than "Invalid" in Column A, but there are some unintended bugs that are making me want to change and use a variable rather than a number.

    Any help is appreciated!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Remove [Variable] from a column using an Array?

    With your sample data in A1:A6
    This ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (instead of just pressing ENTER)
    begins the listing of NON-Invalid items
    B1: =IFERROR(INDEX(A:A,SMALL(IF(SEARCH("Invalid",$A$1:$A$10&"Invalid")>1,ROW($A$1:$A$10)),ROWS($1:1))),"")
    EDITED TO INCLUDE THIS REGULAR (NON-ARRAY) ALTERNATIVE:
    B1: =IFERROR(INDEX(A:A,SMALL(INDEX((SEARCH("Invalid",$A$1:$A$10&"Invalid")=1)*10^10+ROW($A$1:$A$10),0),ROWS($1:1))),"")

    Copy B1 and paste into B2 and down as far as you need.

    Is that something you can work with?
    Last edited by Ron Coderre; 07-30-2014 at 11:26 AM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    05-20-2013
    Location
    detroit, michigan
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Remove [Variable] from a column using an Array?

    Quote Originally Posted by Ron Coderre View Post
    With your sample data in A1:A6
    This ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (instead of just pressing ENTER)
    begins the listing of NON-Invalid items
    B1: =IFERROR(INDEX(A:A,SMALL(IF(SEARCH("Invalid",$A$1:$A$10&"Invalid")>1,ROW($A$1:$A$10)),ROWS($1:1))),"")
    EDITED TO INCLUDE THIS REGULAR (NON-ARRAY) ALTERNATIVE:
    B1: =IFERROR(INDEX(A:A,SMALL(INDEX((SEARCH("Invalid",$A$1:$A$10&"Invalid")=1)*10^10+ROW($A$1:$A$10),0),ROWS($1:1))),"")

    Copy B1 and paste into B2 and down as far as you need.

    Is that something you can work with?
    That is perfect!! Ah, you're a life saver.

    Thanks

+ 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. Replies: 5
    Last Post: 05-08-2014, 07:24 AM
  2. storing variable single column range into array
    By Prokis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2013, 09:38 AM
  3. Variable File Reference and Variable Table Array in VBA VLOOKUP
    By Gingeiko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2011, 11:08 PM
  4. Replies: 2
    Last Post: 08-18-2009, 01:45 PM
  5. [SOLVED] Variable column to fixed array
    By asaylor in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-09-2006, 12:34 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