+ Reply to Thread
Results 1 to 5 of 5

Sum of the first n factorials

Hybrid View

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    7

    Sum of the first n factorials

    Hi guys,

    I'm trying to find a way to code this formula:

    Sum (from 1 to k) of n!

    So, for example, Sum(1 to 4) of n! = 1! +2! +3! +4! = 24

    In other words, taking sums of the factorial function where the inputs lie in a specified range. Any thoughts or advice would be greatly appreciated!

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Sum of the first n factorials

    Well you could use:

    =SUM(FACT(ROW(1:4)))

    Confirmed with Ctrl-Shift-Enter

    Where the row numbers (1 and 4 in this case) represent the start and end points of your range.

    However, are you sure this is what you want?

    1!=1=1
    2!=1*2=2
    3!=1*2*3=6
    4!=1*2*3*4=24

    Therefore SUM of 1! - 4! = 1+2+6+24 = 33

  3. #3
    Registered User
    Join Date
    08-31-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Sum of the first n factorials

    Hi Andrew,

    I tried out the formula you posted in the response and although it works pretty well, I think it's taking the range reference in the row function from the row numbers themselves; I was wondering if I could find a way to calculate factorials using individual cell references. So, for example, let's say i type the formula =(1+3) in cell A1, and I want my factorial function to go something like this:

    =sum(fact(1:A1))

    I've been trying to find a way to specify a numerical range using cell references, but no luck so far. I only need to take ranges over positive sequential integers in this case.

    Thanks!

  4. #4
    Registered User
    Join Date
    08-31-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Sum of the first n factorials

    Hi Andrew,

    Thanks for your help. And yes, you are correct; I incorrectly calculated the sum of the first 4 factorials in the original post. I accidentally put 4! in place of SUM of 1! - 4!.

    Thanks again; I'll try out the formula and get back to you if I can't get it working.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Sum of the first n factorials

    =sumproduct(fact(row(indirect("1:" & A1))))
    Last edited by shg; 09-04-2012 at 12:58 PM.
    Entia non sunt multiplicanda sine necessitate

+ 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