# How to Create Finance Function

1. ## How to Create Finance Function

Hey everyone I am new to programing in Excel and I do not know enough to wright a function that finds variance of a portfolio. This is what i have so far its messy and does not work.

Function VARPORT(Sa,Wa,Sb,Wb,Sc,Wc,Sd,Wd,Se,We)

va=VAR(Sa)
vb=VAR(Sb)
vc=VAR(Sc)
vd=VAR(Sd)
ve=VAR(Se)

cab=Covar(va,vb)
cac=Covar(va,vc)
cae=Covar(va,ve)
cbc=Covar(vb,vc)
cbd=Covar(vb,vd)
cbe=Covar(vb,ve)
ccd=Covar(vc,vd)
cce=Covar(vc,ve)
cde=Covar(vd,ve)

End Function

The S stands for a list of stock returns.
The W is what percentage of the portfolio is spent on that stock.
The Covar and Var functions are to calculate the variance of each stock and the covariance between the five.
The three letters are C for covariance and then what stock will be looked at.

This is very confusing to me and I know I just made a big mess, can anyone help or point me int he right direction.

2. ## Re: I need help making a finance function.

Welcome to the forum.

Thanks.

3. ## Re: How to Create Finance Function

This add-in is a possible solution:
http://www.tvmcalcs.com/blog/comment...or_Excel_2007/

There are currently 1 users browsing this thread. (0 members and 1 guests)