Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default how to get the index for a two diemnstional array..

Hi all,

I have a two dimensional array. I populated this array as a variant
by using 3 columns and 30 rows of data. It is as below..

Name1 cde 20
Name2 pdf 30
Name3 xlf 20
Name 4 ppf 20
Name5 xdf 40
and so on..

I read this in to a variant array as below.

Sub GenerateSumArray()
Dim sumCell As Range

Set sumCell =
ThisWorkbook.Sheets("SUMMARY").Range("START_SUMMAR Y").Offset(1, 2)

SummaryArray = Application.Transpose(Range(sumCell,
sumCell.End(xlDown).End(xlToRight)))

End Sub

Now I wish to use data from this SummaryArray. First I need to find out
the index for the "Name5" and then get the corresponding values..So do
we have any built in function like indexof(SummaryArray("Name5")) and
then use that index to get its values(xdf and 40) or do you have a
better suggestion..Thanks in advance...
shishi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default how to get the index for a two diemnstional array..

I assume the data you depict is how it appears in the worksheet and the
array has been transposed so the names are in the first row of the array
rather than the first column.

Dim idx as Long, i as Long

idx = -5
for i = 1 to ubound(summaryarray,2)
if summaryarray(1,i) = "Name5" then
idx = i
exit for
end if
Next
if idex =0 then
msgbox "Name5" & " " & summaryarray(2,idx) & _
" " & summaryarray(3,idx)
Else
msgbox "Name5 not found"
End if

--
Regards,
Tom Ogilvy


"shishi" wrote in message
ups.com...
Hi all,

I have a two dimensional array. I populated this array as a variant
by using 3 columns and 30 rows of data. It is as below..

Name1 cde 20
Name2 pdf 30
Name3 xlf 20
Name 4 ppf 20
Name5 xdf 40
and so on..

I read this in to a variant array as below.

Sub GenerateSumArray()
Dim sumCell As Range

Set sumCell =
ThisWorkbook.Sheets("SUMMARY").Range("START_SUMMAR Y").Offset(1, 2)

SummaryArray = Application.Transpose(Range(sumCell,
sumCell.End(xlDown).End(xlToRight)))

End Sub

Now I wish to use data from this SummaryArray. First I need to find out
the index for the "Name5" and then get the corresponding values..So do
we have any built in function like indexof(SummaryArray("Name5")) and
then use that index to get its values(xdf and 40) or do you have a
better suggestion..Thanks in advance...
shishi



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
Using SUM + INDEX in array formula Dave Ramage Excel Worksheet Functions 5 May 7th 10 09:19 AM
Index using a defined name array Swimmer1500m Excel Worksheet Functions 1 April 27th 10 09:21 AM
Help in finding Value in Index Array George Excel Discussion (Misc queries) 20 October 29th 07 11:48 PM
defining an array for INDEX Dave F[_2_] Excel Discussion (Misc queries) 1 October 2nd 07 07:51 PM
Index of Minimum value in array Paul Stevens Excel Programming 17 December 8th 03 11:36 AM


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