LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default UDF's and Worksheet Function VBA Combinations

Hello,

I'm not sure what I'm doing wrong but I hope someone can
help me. I have a UDF that I want to calculate a value
for me. The normal Worksheet display of the function
would be =IF(ISERROR(AVERAGE(E5:E6)),"",AVERAGE(E5:E8))
I would like this to be a user defined function letting
the range be selectable by the user. I've created Each
individual part of the function and it works correctly but
for some reason when I try each piece together it doesn't
work.

If you run a macro to record the steps of manually
inserting the function the VB looks like.

ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(AVERAGE(R[-16]C[-1]:R[-15]C[-
1])),"""",AVERAGE(R[-16]C[-1]:R[-15]C[-1]))"

I've tried many ways to turn this into a function.
Like I said I can take each individual function and have
it work correctly in a UDF but to combine the IF, ISERROR,
and AVERAGE functions and then assign this value to the
Function name just doesn't seem to work. I've debugged and
it has had the correct true and false values for data that
I tested it on. Oh well, hopefully someone knows.

I would also like to create UDF's for these functions as
well.
=IF(sheet!F3="N/A","N/A",IF(sheet!F3="","",NETWORKDAYS
(sheet!D3,sheet!F3,sheet!D3)))

=SUM(IF(sheet1!$C$2:$C$500="AA",IF(sheet1!
$D$2:$D$500<=DATEVALUE("8/31/2004"),IF(sheet1!
$D$2:$D$500=DATEVALUE("8/1/2004"),IF(sheet1!
$B$2:$B$500="DD",1,0),0),0),0))

I've got a few more questions but I'll hold off for now.
Thanks to whom ever can help me.



 
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
Vlookup plus other function/s combinations required? Twishlist Excel Worksheet Functions 5 January 24th 08 04:42 AM
Permutations or Combinations or some other function?? Mark Siler Excel Discussion (Misc queries) 4 December 23rd 06 04:22 PM
UDF's using other UDF's millsy Excel Worksheet Functions 9 December 18th 05 08:38 PM
Function generating all possible combinations of set of numbers Lucia Excel Worksheet Functions 1 February 7th 05 10:41 PM
Keyboard Shortcuts combinations of function keys, c... FJM Excel Worksheet Functions 1 January 17th 05 11:35 PM


All times are GMT +1. The time now is 11:14 PM.

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"