+ Reply to Thread
Results 1 to 8 of 8

How to Return Values Not Contained in a Range

  1. #1
    Registered User
    Join Date
    11-07-2015
    Location
    Boise, Idaho
    MS-Off Ver
    2013
    Posts
    18

    How to Return Values Not Contained in a Range

    I am trying to figure out how to return values that are not contained in a range. For example, in my attached sheet if I have a range of 1 through 8 in cells A1:H1, in cells A2:D2 I have values, 7, 3, 2, 6.

    How do I return 1, 4, 5, 8 in cells A4:D4? (The numbers of 1 through 8 that are not contained in the cells A4:D4)


    The values do not have to be returned in consecutive order in A4:D4.

    They will not likely ever be consecutive in A2:D2

    They will always be consecutive in A1:H1

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: How to Return Values Not Contained in a Range

    In A4:

    Please Login or Register  to view this content.
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Drag accross
    Quang PT

  3. #3
    Registered User
    Join Date
    11-07-2015
    Location
    Boise, Idaho
    MS-Off Ver
    2013
    Posts
    18

    Re: How to Return Values Not Contained in a Range

    That was entirely too fast of an answer for something I spent over an hour trying to solve!

    It's perfect! Thank you so much for solving my problem!

  4. #4
    Registered User
    Join Date
    11-07-2015
    Location
    Boise, Idaho
    MS-Off Ver
    2013
    Posts
    18

    Re: How to Return Values Not Contained in a Range

    That was entirely too fast of an answer for something I spent over an hour trying to solve!

    It's perfect! Thank you so much for solving my problem!

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: How to Return Values Not Contained in a Range

    I essentially came up with a similar solution, but I see you already have you answer..

    Only change is, even if you add another number to your Row 2, it will take care of the same.

    Anyways,

    =IFERROR(INDEX($A$1:$H$1,1,SMALL(IF(COUNTIF($A$2:$H$2,$A$1:$H$1)=0,COLUMN($A$1:$H$1),""),COLUMNS($A$4:A4))),"")

    Use Ctrl+Shift+Enter

    Cheers!
    Last edited by NeedForExcel; 11-10-2015 at 02:00 AM.
    Cheers!
    Deep Dave

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: How to Return Values Not Contained in a Range

    Another way. Array-entered in A4 an filled across.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Array formulas are not committed in the regular way. You commit by pressing and holding Ctrl + Shift as you hit Enter. You will know that it has been entered successfully when you can see curly braces {} around your formula in the formula bar. You do not type these in yourself. Excel does it for you.
    Dave

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: How to Return Values Not Contained in a Range

    Quote Originally Posted by Kerik View Post
    That was entirely too fast of an answer for something I spent over an hour trying to solve!

    It's perfect! Thank you so much for solving my problem!
    Thanks for your kind words.
    It is a typical question and it does not take much time to get around and to build a formula.

  8. #8
    Registered User
    Join Date
    11-07-2015
    Location
    Boise, Idaho
    MS-Off Ver
    2013
    Posts
    18

    Re: How to Return Values Not Contained in a Range

    Quote Originally Posted by NeedForExcel View Post
    I essentially came up with a similar solution, but I see you already have you answer..

    Only change is, even if you add another number to your Row 2, it will take care of the same.

    Anyways,

    =IFERROR(INDEX($A$1:$H$1,1,SMALL(IF(COUNTIF($A$2:$H$2,$A$1:$H$1)=0,COLUMN($A$1:$H$1),""),COLUMNS($A$4:A4))),"")

    Use Ctrl+Shift+Enter

    Cheers!


    This will also come in handy, I will likely use it for a different spreadsheet. Thanks for providing it.

+ 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: 1
    Last Post: 11-07-2014, 01:42 PM
  2. [SOLVED] If cell contains text contained in a named range return the row number
    By spoursy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-05-2014, 05:54 AM
  3. [SOLVED] Return value if within range, return multiple values if ranges overlap
    By cde1983 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-17-2013, 06:16 AM
  4. [SOLVED] Return specific text if a different text is contained anywhere in a range of cells
    By ciayers in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2013, 05:54 PM
  5. Replies: 2
    Last Post: 11-12-2012, 06:26 AM
  6. [SOLVED] How to increment values contained in a Variant and to put in a Range
    By JohnM3 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2012, 10:10 AM
  7. Return a value if criteria contained in cell
    By jhicsupt in forum Excel General
    Replies: 7
    Last Post: 10-05-2005, 05:05 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