+ Reply to Thread
Results 1 to 3 of 3

Matching two arrays - Part 1

  1. #1
    Registered User
    Join Date
    12-14-2005
    MS-Off Ver
    2016
    Posts
    12

    Matching two arrays - Part 1

    Hi

    Need some help.
    This is what I am facing
    I have two arrays with the following unique values
    Array1: a,b,c,d,e (all unique,no repetition)
    Array2: a,b,c,d,e,f,g,h,i,j (these values can be repeated as a,b,a,a,c,b,j,h...)

    Every time the array 2 element matches the array 1 element, in a new column I want the value 1, else 0
    eg for the above series (1,1,1,1,1,1,0,0)

    I have looked up the forum but not found the right answer.
    Please help.

    Thanks in advance

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

    Re: Matching two arrays - Part 1

    I have no doubt the other guys who are actually good with Arrays can come up with a more efficient method than this

    Please Login or Register  to view this content.
    depending on case sensitivity of match etc you might wish to adjust the comparison method

    edit:

    Quote Originally Posted by PradeepRed
    Every time the array 2 element matches the array 1 element
    do you mean you want to conduct a Match on each element to the unique vals to see if it exists (irrespective of position) - I suspect you do ....
    Last edited by DonkeyOte; 09-17-2010 at 04:08 AM.

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

    Re: Matching two arrays - Part 1

    If my edit's correct then in theory you could use something like the below rather than iterating v2 item by item:

    Please Login or Register  to view this content.
    though the above in that form would return Boolean True/False rather than 1/0
    (and Match is not case sensitive - unknown if that's an issue or not)

+ 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