+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Valued Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    291

    Function to return a "true" if three values in an array match.

    Hello, I need to figure out how to match three values on the "source info.xls" file attached to the "PFG FILE.xls" that is also attached. In column A in the "Source info.xls" file the formula will need to match the yellow column, then the green column, then the red column. Please keep in mind that the attached files are just a small subset of data. The "PFG File.XLS" is actually 150K rows long.

    Thanks for your help!
    Attached Files Attached Files
    Last edited by dcgrove; 01-28-2010 at 04:05 PM.

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Function to return a "true" if three values in an array match.

    If you have the volume of data you say you have then you should really be looking at means to keep the linked formula as efficient as possible.

    On that basis I would suggest you do the following

    Code:
    PFG File.xls
    
    P4: =$C4&"@"&$E4&"@"&$O4
    copied down for all rows
    Then

    Code:
    source info.xls
    
    A3: =ISNUMBER(MATCH($C3&"@"&$H3&"@"&$F3,'[PFG FILE .xls]Sheet1'!$P$4:$P$150000,0))
    copied down
    NOTE: above formula assumes both files are open at the time of being added and that file is XL2007 (ie 150000 is a valid reference)

    It would be even better if you could sort PFG File by C, E & O in that order of preference as you could then run a MATCH utilising Binary Search which would greatly reduce the amount of cells being processed.
    That is the implication of your file but given there is only one store we can't be sure...
    Last edited by DonkeyOte; 01-26-2010 at 01:38 PM. Reason: incorrect cell refs. in the MATCH - ie C3 etc not C4

  3. #3
    Valued Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    291

    Re: Function to return a "true" if three values in an array match.

    DonKeyote, I can sort the PFG file. The data is originally in a text file that I import into the PFG Data file. I am not sure how to run the MATCH function with the binary search though. Can you explain?

    Thanks!

  4. #4
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Function to return a "true" if three values in an array match.

    If the data is sorted by C & E & O then in theory you can conduct a MATCH using the default match_type setting of 1 rather than the exact match setting of 0

    Code:
    A3:
    =INDEX('[PFG FILE .xls]Sheet1'!$P$4:$P$150000,MATCH($C3&"@"&$H3&"@"&$F3,'[PFG FILE .xls]Sheet1'!$P$4:$P$150000))=$C3&"@"&$H3&"@"&$F3
    copied down
    When MATCH uses it's default setting of 1/TRUE it uses Binary Search and searches a much smaller subset of data making it much much quicker.... esp. on large data sets such as this.

    For a graphical representation of how Binary Search works see: http://www.mrexcel.com/forum/showpos...98&postcount=7

    Of course it will not be conducting an exact match rather it will return the last value <= criteria value.
    Given this fact we subsequently conduct an additional test to see if the value returned c/o of the binary search matches the criteria... this is our Boolean output.

    Make sense ?
    Last edited by DonkeyOte; 01-26-2010 at 02:27 PM. Reason: repetition in narrative

  5. #5
    Valued Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    291

    Re: Function to return a "true" if three values in an array match.

    DonKeyote, thank you for the help. I have included the second set of formula you suggested but have run into an issue and cannot figure it out. Some of the cells are indicating "False" in the book1.xlsx file (an example is highlighted) but the data is actually included in the PFG FILES.xlsm. do you think you could take a look at it and see if you can tell why?

    I had to upload the files somewhere else because it is too large.
    PFG File.xlsm
    Book1.xlsx

    Thanks!

  6. #6
    Valued Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    291

    Re: Function to return a "true" if three values in an array match.

    Donkeyote, thank you for your help on this. While reading through your suggested reading links in your sig, I figured out that a sumproduct could could do what required. I ended up using the formula below to return a 1 or 0 for in place of true/false. Without your original suggestions, I would have never thought to use the "&" to combine the three cells I was trying to match.

    =SUMPRODUCT(--('[011910 Data File.xlsx]PFGTRANS011910'!$A$2:$A$229616=C4&H4&F4))

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.2.0