Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
functions
dear all
I have two questions 1) How can I write a function that accepts multiple inputs (arguments) and return multiple values? The straightforward method accepts multiple values and returns a single value (that is the name of the function) 2) How can I write a function that accepts multiple arrays as input arguments and returns an array too. ex: if I have two arrays x , y how can I configure a function f(x,y) that return an array representing the pointwise multiplication of x,y i.e f(i)= x(i)* y(i) thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
functions
Public Function MultArray(x, y)
Dim f() As Double ReDim f(LBound(x) To UBound(x)) For i = LBound(x) To UBound(x) f(i) = x(i) * y(i) Next MultArray = f End Function Sub tester4() Dim u As Variant Dim x As Variant, y As Variant x = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) y = Array(2, 4, 6, 8, 10, 12, 14, 16, 18, 20) u = MultArray(x, y) For i = LBound(u) To UBound(u) Debug.Print i, u(i) Next End Sub Would be one possibility -- Regards, Tom Ogilvy marwan hefnawy wrote in message ... dear all I have two questions 1) How can I write a function that accepts multiple inputs (arguments) and return multiple values? The straightforward method accepts multiple values and returns a single value (that is the name of the function) 2) How can I write a function that accepts multiple arrays as input arguments and returns an array too. ex: if I have two arrays x , y how can I configure a function f(x,y) that return an array representing the pointwise multiplication of x,y i.e f(i)= x(i)* y(i) thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to convert cell formula functions to code functions | Excel Discussion (Misc queries) | |||
formula/functions for average and if functions | Excel Worksheet Functions | |||
efficiency: database functions vs. math functions vs. array formula | Excel Discussion (Misc queries) | |||
Looking for a site with functions that substitute the ATP functions | Excel Worksheet Functions | |||
Nesting functions in the functions dialog box | Excel Worksheet Functions |