LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default using array, Match, trying to eliminate duplicates - how to return or translate result to a boolean?

I am cycling through some larger multidimensional arrays to find records
that match certain criteria. When I find a match, I copy a row of data to a
smaller array, which ultimately populates a row in my spreadsheet (after I
find all the matches, I add them to the target cell with a chr(10) between
each, to put each match on a new "row" within the cell).

I've run into a problem with duplicate matches, which results in my row
having duplicate data in it. I think I know how to address this, I'm just
not sure of the syntax to make it work.

Assuming I will never have more than 10 good (non-duplicate) matches, and I
do have a unique field to compare, I was thinking of adding a new
one-dimensional array and clearing it between excel rows. Each time I find
an entry that matches my criteria, I would just use the match function to
see if that value was already in the one dimensional array, and if so, skip
to the next match (if it isn't in the 1-D array, add it as normal).

So I've put some code below, but it returns a position or N/A. What is the
best way to translate that into a boolean so I can use it in my IF
statement?

'--------------------------------------------------------------
Dim CompareArray(1 to 10)
Dim CompareItem as String
Dim FoundDuplicate as Boolean

'do stuff until a match is found

FoundMatch = Excel.worksheetfunction.Match(CompareItem, CompareArray,0)

'how do I translate FoundMatch (integer or N/A) into FoundDuplicate Boolean?

If FoundDuplicate = False then
'add it to my larger data array
End if
'---------------------------------------------------------------


--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return match result gootroots Excel Worksheet Functions 1 November 3rd 09 10:48 AM
How do I return multiple occurrences of a match in an array? Umbu Excel Worksheet Functions 1 May 25th 08 05:07 PM
Help with Excel array functions - select, add & return result [email protected] Excel Worksheet Functions 0 July 12th 07 06:36 PM
return array result in cell based on comparing dates Ruthki Excel Worksheet Functions 7 June 30th 05 11:41 PM
match multiple criteria & return value from array Tat Excel Worksheet Functions 2 June 21st 05 04:31 PM


All times are GMT +1. The time now is 06:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"