+ Reply to Thread
Results 1 to 6 of 6

using VB in excel

Hybrid View

  1. #1
    dziw
    Guest

    Question using VB in excel

    just wondering if anyone can point me in the right direction for help using vb functions in excel, i want to program a summation function of 1 to n values using a for loop and want to make the vb function read numbers from a cell in excel and use them to add values together, any pointers?

    thanks

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,423
    put "Excel user defined function" into your favorite internet search engine and have fun.

  3. #3
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    You don't need a function to do this. There is a mathematical formula as follows:

    = n(n+1)/2

    Matt

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,423
    Good, Mallycat. That works for f(n)=sum(i=1 to n)i It's been too long since I've done those kind of derivations, so I couldn't figure out a shortcut for the actual formula dziw is using. In his other posts, the summation he's using is f(n)=sum(i=1 to n)(A^-i). Are you aware of or could derive a simple shortcut formula for that one?

  5. #5
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    Quote Originally Posted by MrShorty
    It's been too long since I've done those kind of derivations,
    Me too actually. I had to fill a stack of cells with running data and work it out. It took me back! As for this new formula, what is the A all about. Will the answer always have an A in it?

    f(n)=sum(i=1 to n)(A^-i)

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,423
    I don't know what A is, other than some constant. The samples he gave were A~1.05 and A=1.5. I don't know if A will always be between 1 and 2 or 1 and 1.5 or what A represents.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1