array

  • Thread starter Thread starter toby
  • Start date Start date
T

toby

I'm trying to write an array that is going to return to me
a text value and a numerical value.

Has anyone ever done this?
 
All its something liek this:

1/1/04
-----Original Message-----
Hi Toby
I really don't know what you're meaning :-)
can you give more details?

--
Regards
Frank Kabel
Frankfurt, Germany


.
 
All its soemthing like this: Imagine the following to be
an excel spreadsheet with value in two columns and two rows

1/1/04 12/31/03
Not Specified 3.02

In my array, I want to able to return "Not Specified" when
1/1/04 is typed into a cell as well as 3.02 when 12/31/03
is typed into cell.

Thanks
 
Hi Toby
?????
maybe something like
=1 & "/" & "04"

Sorry, but what do you expect from a line
1/1/04
as a response :-)

So state the following:
- what do you mwan with array
- what is your source data
- what is your expected result
- do you want VBA or a worksheet function
 
Toby,

Perhaps you mean a user defined type?

Public Type myStuff
myText As String
myInt As Integer
End Type

Sub TryNow()
Dim myArr(1 To 2) As myStuff
Dim i As Integer

myArr(1).myText = "Test"
myArr(1).myInt = 2
myArr(2).myText = "Value"
myArr(2).myInt = 3

For i = 1 To 2
MsgBox myArr(i).myText
MsgBox myArr(i).myInt
Next i
End Sub


Or simply a variant array?

Dim myArr(1 To 2) As Variant
Dim i As Integer
myArr(1) = "Test"
myArr(2) = 3.2
For i = 1 To 2
MsgBox myArr(i)
Next i


HTH,
Bernie
MS Excel MVP
 
Hi
still in the dark but enter the following in A2
=IF(A1=DATE(2004,1,1),"not specified",3.02)
and copy to the right
 
Perhaps...

=INDEX(A2:B2,MATCH(D1,A1:B1,0))

or equivalently:

=HLOOKUP(D1,A1:B2,2,0)

where A1:B2 houses your sample data and D1 a value like 1/1/04.
 
Back
Top