Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Array Question

I populate an array from data in a text file. Then I go to a spreadsheet and
I look at a cell and want to find the text in that cell in the array. Is
there an arrayfind() function to find the data that is in the cell? And can
I sort the array so that the find is faster?

Also, I populate a similar array with values. Can I have both types of data
in one array, text and values?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Array Question

If the text file has the right layout then you could run SQL on that file.
This would save you the intermediary step of the array and is quite fast.

Yes, you can sort arrays and then do a binary search, which could be a lot
faster.

Yes, you can have variant arrays that can hold both string data and numeric
data.


RBS

"Mike H." wrote in message
...
I populate an array from data in a text file. Then I go to a spreadsheet
and
I look at a cell and want to find the text in that cell in the array. Is
there an arrayfind() function to find the data that is in the cell? And
can
I sort the array so that the find is faster?

Also, I populate a similar array with values. Can I have both types of
data
in one array, text and values?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 200
Default Array Question

Mike H. wrote:
I populate an array from data in a text file. Then I go to a spreadsheet and
I look at a cell and want to find the text in that cell in the array. Is
there an arrayfind() function to find the data that is in the cell?


If your array is one-dimensional or a single"column", then e.g.,
=Application.Match(Range("A3").Value, yourArray) will return the
"column" number in the array of the value that is in A3 (or the row
number if the array is a single "column").

Alan Beban
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Array Question

The array can have any values you want, with wildly different ones you would
typically dim it as Variant. as far as finding, there are ways, but the
system can probably loop through your array just as fast.
do until myArray(myindex,1)=cells(1,1)

myindex=myindex+1
loop
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Mike H." wrote:

I populate an array from data in a text file. Then I go to a spreadsheet and
I look at a cell and want to find the text in that cell in the array. Is
there an arrayfind() function to find the data that is in the cell? And can
I sort the array so that the find is faster?

Also, I populate a similar array with values. Can I have both types of data
in one array, text and values?

Reply
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
Array question AD108 Excel Programming 2 September 6th 06 05:11 PM
Array question vqthomf Excel Programming 6 August 31st 06 08:28 AM
Another ARRAY Question... Trevor Williams Excel Programming 2 July 31st 06 03:28 PM
array question john petty Excel Programming 1 August 29th 03 04:57 PM
Is this an array question? Stuart[_5_] Excel Programming 0 August 5th 03 08:53 PM


All times are GMT +1. The time now is 04:35 AM.

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

About Us

"It's about Microsoft Excel"