+ Reply to Thread
Results 1 to 7 of 7

Variable Array

  1. #1
    Registered User
    Join Date
    08-28-2010
    Location
    Earth
    MS-Off Ver
    Excel 2019
    Posts
    14

    Variable Array

    Hi, 2 simple questions...

    1)
    I have a formula which searches for a value in an array A1:A10.
    I also have a cell B1 which contains the number 5.

    How do write a formula which will search for a value in a new array which is down 5 rows?

    So if B1=5, the formula will search the array A5:A14
    Or if B1=7, the formula will search the array A7:A16
    if B1=1, the formula will search the array A1:A10
    etc...


    2)
    If I have a large 2D array, is there a simple formula to reply TRUE or FALSE if there are two cells anywhere in the array that are the same?

    Thanks in advance,
    Dave.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Variable Array

    Hi Dave, welcome to the forum.

    For the first issue, try:

    =ISNUMBER(MATCH("Tom",INDIRECT("A"&B1&":A"&B1+10),0))

    Replace "Tom" with the value you're after, or a cell reference to that value.

  3. #3
    Registered User
    Join Date
    08-28-2010
    Location
    Earth
    MS-Off Ver
    Excel 2019
    Posts
    14

    Re: Variable Array

    Thanks Paul, I got what I wanted with the INDIRECT formula

    Anyone have any ideas for the second problem?
    Basically I have a table of names, but I would like some sort of error msg to appear if the same name is repeated twice. When I say error msg, it could just be a cell returning TRUE instead of FALSE or something like that.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Variable Array

    Other alternatives for question 1

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    OFFSET like INDIRECT is Volatile - INDEX is semi-volatile in so far as it is only Volatile on the file being opened (thereafter non-volatile).

    For Question 2

    Assume 2d Array is A1:B100 and blanks are to be discounted:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-28-2010
    Location
    Earth
    MS-Off Ver
    Excel 2019
    Posts
    14

    Re: Variable Array

    Thanks Donkey, the OFFSET formula will come in handy.

    The Array formula works nicely, though I must confess I have no understanding of how it works! I need to read up on Array formulas first I think.

    Cheers.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Variable Array

    Quote Originally Posted by davidstrongarm
    I need to read up on Array formulas first I think.
    see the link in my sig. to Colin Legg's extensive tutorial

    Quote Originally Posted by davidstrongarm
    The Array formula works nicely, though I must confess I have no understanding of how it works!
    In this instance the function "iterates" each cell within the range specified and where the value is non-blank/non-null it performs a COUNTIF to determine how many times the current "iterated" value appears within the main range.
    A MAX is then applied to the array of resulting values ... if the MAX returned exceeds 1 then you know you have at least one instance of a duplicate.

  7. #7
    Registered User
    Join Date
    08-28-2010
    Location
    Earth
    MS-Off Ver
    Excel 2019
    Posts
    14

    Re: Variable Array

    Great! Thanks so much for the help guys!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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