can I test if a variable is a member of an array

A

Andy Clarke

I have a very large spreadsheet containing raw data for the whole world. I am
only interested in certain countries, and I have to group the countries into
market groupings, such as Benelux for Belgium, Netherlands and Luxembourg.

I have set up an array containing all the countries required (70 of them),
and several other arrays for each market grouping.

As I read through the spreadsheet, row by row, I want to test if the country
is one that I am interested in. Therefore, it would be best if there was a
function to test if the country is a member of my countries array.

At the moment, I am looping and testing if each country is member1, then
member 2, etc. Therefore, there is a 70-stage loop for each row in the
spreadsheet. And then I test again to see which market grouping they belong
to ...

There must be a much more efficient way of doing this.

Any ideas?

Thanks
 
R

Rick Rothstein \(MVP - VB\)

If the array you are looping through is a one-dimensional String array, then
look up the Filter function in the help files.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top