LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default How to exclude a list of number from another list?

Thank you very much for all the responses.

I've chosen the one using the scripting dictionary. It seems the easiet one
to use without any more tinkering.

Herbert

"AA2e72E" ...
This solution does not use any objects/references:

Sub array2Withoutarray1()
array1 = Array(31.4, 41.1, 7, 15.4, 47.2, 90.4, 34.5, 58, 29.7, 8.9)
array2 = Array(63.5, 75.3, 7, 1.8, 27.7, 34.5, 24.6, 34.7)
result = Without(array2, array1)
End Sub

Function Without(ByVal Keep As Variant, ByVal Exclude As Variant) As
Variant
Keep = "," & Join(Keep, ",")
For i = LBound(Exclude) To UBound(Exclude)
Keep = Replace(Keep, "," & Exclude(i), "")
Next
If "," = Mid(Keep, 1, 1) Then Keep = Mid(Keep, 2)
Without = Split(Keep, ",")
End Function


"Herbert Chan" wrote:

Hello,

I've two lists of data in array in VBA.

How do I exclude the data in array1 from array2 so that I will be left
with
an array2 that does not contain any number in array1?

I need this function in VBA.

Thanks.

Herbert





 
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
How do I Exclude a list of dates in a date calculation? Ryan Excel Worksheet Functions 2 June 11th 08 12:29 AM
filtering a list to exclude 2 different dates Sarah Excel Worksheet Functions 4 September 28th 07 07:34 PM
Exclude cells that are the same as list in Excel 03 jamo2983 Excel Discussion (Misc queries) 1 January 24th 07 11:24 PM
list 1 has 400 names List 2 has 4000. find manes from list 1 on 2 Ed Excel Worksheet Functions 5 September 12th 05 09:48 AM
HOW DO I TOTAL A FILTERED LIST TO EXCLUDE THOSE EXCLUDED BY FILTE. paul abc Excel Worksheet Functions 2 August 11th 05 07:37 PM


All times are GMT +1. The time now is 09:39 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"