Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default is it possible to store formula under a UDF

You need to tell us what you are talking about. A UDF is meant to create a
custom formula to return a value.

--
Don Guillett
SalesAid Software

"been drilbled to 2007" wrote
in message ...
hello,

i got some few formulas that i need to be stored under a UDF. please
respond
if you can help me with this.


dribler2



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default is it possible to store formula under a UDF

LOOKUP(WEEKDAY(T1),{1,2,3,4,5,6,7},{7,6,5,4,3,2,1} )

Hi. Just 2 cents. If I'm not mistaken, the above part might be reduced to
the following:

8-WEEKDAY(T1)

--
Dana DeLouis
Windows XP & Office 2003


"Tom Ogilvy" wrote in message
...
With Worksheets("Sheet1")
set rng = .Range(T2:T2000)
End With
rng.Formula =
"=IF(T1=LOOKUP(MAX(holidays),holidays),T1,IF(AND(W EEKDAY(T1)=1,LOOKUP(T1,holidays)=T1),T1+1,IF(OR(AN D(LOOKUP(T1,holidays)=T1,WEEKDAY(T1)=6),AND(LOOKUP (T1+2,holidays)=T1+2)),T1+1,MIN(T1+(LOOKUP(WEEKDAY (T1),{1,2,3,4,5,6,7},{7,6,5,4,3,2,1})),INDEX(holid ays,MATCH(T1,holidays,ROW(T1))+1)))))"

or

set rng = Range("N_WD")
then as above.

if you don't want the formula to refer to the cell above it, then you
would
need to add some dollar signs to fix the references. I have no idea what
you
are doing, so I can't say.

--
Regards,
Tom Ogilvy

<snip


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default is it possible to store formula under a UDF

A couple of typos
set rng = .Range(T2:T2000)
set rng = .Range("T2:T2000")

Also, rng.formula= to the end is ONE line.

--
Don Guillett
SalesAid Software

"been drilbled to 2007" wrote
in message ...
Sir Tom,

really i am stupid with this language, i copy and paste the code and there
is an alarming pop-up window with an exclamation "!" mark..it saya Compile
error: Invalid outside procedure....

about the T1,
the formula i gave is first located in T2, and then i drag it down to
populate the formula under a column..
since my co-office personnel are more dumbererer than i am in terms of
excel, that's why i need a macro that will enable them to hit or run a
macro...more easier for me to explain...
otherwise, i will have to provide them a neverending explanation of what
are
those functions doing in one formula....

thanks for your enlightenment ,
4pinoyjunior
--
*****
birds of the same feather flock together..



"Tom Ogilvy" wrote:

With Worksheets("Sheet1")
set rng = .Range(T2:T2000)
End With
rng.Formula =
"=IF(T1=LOOKUP(MAX(holidays),holidays),T1,IF(AND(W EEKDAY(T1)=1,LOOKUP(T1,holidays)=T1),T1+1,IF(OR(AN D(LOOKUP(T1,holidays)=T1,WEEKDAY(T1)=6),AND(LOOKUP (T1+2,holidays)=T1+2)),T1+1,MIN(T1+(LOOKUP(WEEKDAY (T1),{1,2,3,4,5,6,7},{7,6,5,4,3,2,1})),INDEX(holid ays,MATCH(T1,holidays,ROW(T1))+1)))))"

or

set rng = Range("N_WD")
then as above.

if you don't want the formula to refer to the cell above it, then you
would
need to add some dollar signs to fix the references. I have no idea what
you
are doing, so I can't say.

--
Regards,
Tom Ogilvy


I have no idea what you mean by

"been drilbled to 2007" wrote:

i'm sorry Sir Tom,

i'm a real junior in terms of creating a macro.

i've seen in help files a lot of references about which methods, or
whatever....

can you be patient for this one by giving me a copy-paste module

the formula i had to paste on T2:T2000 or more..and run the macro and
then
the range T1:T2000 or more will have a defined "N_WD"
T1 is linked to the first cell of column range name "holidays"

thanks for enlightenment
4pinoyjunior
--
*****
birds of the same feather flock together..



"Tom Ogilvy" wrote:

If the range Holidays is already defined as a workbook level name, it
makes
no difference where it is located

With Worksheets("Sheet1")
set rng = .Range(.Cells(1,"S"),.Cells(1,"S").End(xldown))
End With
rng.Formula =
"=IF(T1=LOOKUP(MAX(holidays),holidays),T1,IF(AND(W EEKDAY(T1)=1,LOOKUP(T1,holidays)=T1),T1+1,IF(OR(AN D(LOOKUP(T1,holidays)=T1,WEEKDAY(T1)=6),AND(LOOKUP (T1+2,holidays)=T1+2)),T1+1,MIN(T1+(LOOKUP(WEEKDAY (T1),{1,2,3,4,5,6,7},{7,6,5,4,3,2,1})),INDEX(holid ays,MATCH(T1,holidays,ROW(T1))+1)))))"

--
Regards,
Tom Ogilvy




"been drilbled to 2007" wrote:

Hi, Sir Tom,
this is the formula
=IF(T1=LOOKUP(MAX(holidays),holidays),T1,IF(AND(WE EKDAY(T1)=1,LOOKUP(T1,holidays)=T1),T1+1,IF(OR(AND (LOOKUP(T1,holidays)=T1,WEEKDAY(T1)=6),AND(LOOKUP( T1+2,holidays)=T1+2)),T1+1,MIN(T1+(LOOKUP(WEEKDAY( T1),{1,2,3,4,5,6,7},{7,6,5,4,3,2,1})),INDEX(holida ys,MATCH(T1,holidays,ROW(T1))+1)))))
T1 is a cell address

Named range : holidays (column range)

Can it be possible that i can run the macro say in sheet1, while
the
holidays are in sheet2.
thanks for enlightenment
4pinoyjunior

--
*****
birds of the same feather flock together..



"Tom Ogilvy" wrote:

Private Sub CommandButton1_click()
Range("Name1").Formula = "=Sum(A1:F1)"
End Sub

--
Regards,
Tom Ogilvy

"been drilbled to 2007" wrote:

Hi Sir Don,

sorry for my poor english, maybe what i mean is a macro to
trigger the
embedding of a long formula under a named range...
wherein the formula is built with different excel fx and the
cells are with
defined names...
i never know anything about this

thanks
4pinoyjunior
--
*****
birds of the same feather flock together..



"Don Guillett" wrote:

You need to tell us what you are talking about. A UDF is
meant to create a
custom formula to return a value.

--
Don Guillett
SalesAid Software

"been drilbled to 2007"
wrote
in message
...
hello,

i got some few formulas that i need to be stored under a
UDF. please
respond
if you can help me with this.


dribler2





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
To store the formula in a string pol Excel Discussion (Misc queries) 4 December 2nd 08 02:14 PM
store address in a cell and use it in formula gbalamani Excel Discussion (Misc queries) 1 April 17th 07 10:36 AM
store inventory sheet(ex:sports equipment store) vardan Excel Worksheet Functions 1 October 11th 06 12:51 AM
Store formula in Cell ggant Excel Discussion (Misc queries) 3 December 14th 05 08:11 PM
Store formula in Cell CLR Excel Discussion (Misc queries) 0 December 14th 05 05:45 PM


All times are GMT +1. The time now is 08:58 AM.

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"