View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default user defined functions

See the response to your post in .newusers from yesterday.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hello:

I have a nested function that is uncomfortably long for typing:

=SUMPRODUCT(SUMIF(INDIRECT("'" & wslist & "'!A1"),"<0",INDIRECT("'"&
wslist & "'!A1")))

As is, the function applies to the A1 cell. If I wish to use it with
another cell, say C3, (but the same wslist) I would type

=SUMPRODUCT(SUMIF(INDIRECT("'" & wslist & "'!C3"),"<0",INDIRECT("'"&
wslist & "'!C3")))

Is it possible to define a function, e.g. MySum(cell) such that the
above examples would reduce to MySum(A1) and MySum(C3), respectively?

I was advised on another group of a great replacement

=SUMPRODUCT(SUMIF(INDIRECT("'" & wslist & "'!" &
ADDRESS(ROW(A1),COLUMN(A1),4)),"<0",INDIRECT("'"& wslist & "'!" &
ADDRESS(ROW(A1),COLUMN(A1),4))))

which proves that being longer is not necessarily being less amenable to
typing, for it now can be copied and pasted. Still, if it were possible
to use a simple name like MySum for the whole expression it would be
less intimidating.

Thank you,
Alex