Creating new function

  • Thread starter Creating new function
  • Start date
C

Creating new function

How can I create a new function like G(x)=5*x+4*x*x+sin(x), save it as a new function, and use it anywhere else like any other standard function (like :SUM() and SQR(x))x
 
M

Mark Graesser

Creating new function,
You can follow this procedure to create a user defined function (UDF):

1) Tools>Macro>Macros>
2) Type in function name and hit Create
3) Enter the following code:

Public Function FUNCTION1(x)
FUNCTION1 = 5 * x + 4 * x * x + Sin(x)
End Function

Now you can call this function with =FUNCTION1(A1), but only on this workbook. You coould instead put the macro into your personal.xls file and then you can call the function in any workbook, on your computer, with =Personal.xls!FUNCTION!(A1).

For more info on macros and function you can go to Chip Pearson's site at:
http://www.cpearson.com/excel/differen.htm


Good Luck,
Mark Graesser
(e-mail address removed)

----- Creating new function wrote: -----

How can I create a new function like G(x)=5*x+4*x*x+sin(x), save it as a new function, and use it anywhere else like any other standard function (like :SUM() and SQR(x))x
 
M

Mark Graesser

Mrvin,
I missed that one completely. I should have noticed the wording was a bit formal. :|

Mark Graesser

----- MrvinGover > wrote: -----

Are you just using this forum to do your algebra/excel class homework?
 
N

Norman Harker

Hi Mark!

Or far worse from my (academic) viewpoint. OP uses your solution and
doesn't acknowledge the assistance.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
M

Mark Graesser

Hi Harlan
Your right. I hadn't considered that aspect

Regards
Mark Graesse
(e-mail address removed)

----- Norman Harker wrote: ----

Hi Mark

Or far worse from my (academic) viewpoint. OP uses your solution an
doesn't acknowledge the assistance

--
Regard
Norman Harker MVP (Excel
Sydney, Australi
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments
available free to good homes
 
N

Norman Harker

Hi Dave!

That's kinder than:

Harlan Grove > Norman Harker
Or:
Harlan Grove < Norman Harker

Depending upon perspective and aspect being measured.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
M

Mark Graesser

Sorry about that. You both post so frequently, and I am genetically predispoded to using the wrong names. My father calls me by my brothers names all the time.

Regards,
Mark Graesser

----- Norman Harker wrote: -----

Hi Dave!

That's kinder than:

Harlan Grove > Norman Harker
Or:
Harlan Grove < Norman Harker

Depending upon perspective and aspect being measured.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
N

Norman Harker

Hi Mark!

No worries! No offence taken by me.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top