Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shankley
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

Basically, I need to do a Sum of the Squares of the first 'n' Natural
Numbers. Something like:

function_name(n)

If 'n' is 8 say, then the function would return 204.

Thats 1*1 + 2*2 + 3*3 + 4*4 + 5*5 + 6*6 + 7*7 + 8*8

Likewise if 'n' is 6 say, then the function would return 91!

Or, if no funtion possible, is it possible to do the calculation with
conventional methods?

Thanks,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dana DeLouis
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

Hi. If your number is in A1, then perhaps...

=A1*(1 + A1)*(1 + 2*A1)/6

--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"Shankley" wrote in message
...
Basically, I need to do a Sum of the Squares of the first 'n' Natural
Numbers. Something like:

function_name(n)

If 'n' is 8 say, then the function would return 204.

Thats 1*1 + 2*2 + 3*3 + 4*4 + 5*5 + 6*6 + 7*7 + 8*8

Likewise if 'n' is 6 say, then the function would return 91!

Or, if no funtion possible, is it possible to do the calculation with
conventional methods?

Thanks,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

One way where A1 holds n

=SUMPRODUCT(ROW(INDIRECT("1:" & A1))^2)


--

Regards,

Peo Sjoblom

http://nwexcelsolutions.com



"Shankley" wrote in message
...
Basically, I need to do a Sum of the Squares of the first 'n' Natural
Numbers. Something like:

function_name(n)

If 'n' is 8 say, then the function would return 204.

Thats 1*1 + 2*2 + 3*3 + 4*4 + 5*5 + 6*6 + 7*7 + 8*8

Likewise if 'n' is 6 say, then the function would return 91!

Or, if no funtion possible, is it possible to do the calculation with
conventional methods?

Thanks,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

A small variation, array entered

=SUMSQ(ROW(INDIRECT("1:"&A1)))

"Peo Sjoblom" wrote:

One way where A1 holds n

=SUMPRODUCT(ROW(INDIRECT("1:" & A1))^2)


--

Regards,

Peo Sjoblom

http://nwexcelsolutions.com



"Shankley" wrote in message
...
Basically, I need to do a Sum of the Squares of the first 'n' Natural
Numbers. Something like:

function_name(n)

If 'n' is 8 say, then the function would return 204.

Thats 1*1 + 2*2 + 3*3 + 4*4 + 5*5 + 6*6 + 7*7 + 8*8

Likewise if 'n' is 6 say, then the function would return 91!

Or, if no funtion possible, is it possible to do the calculation with
conventional methods?

Thanks,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shankley
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

On Mon, 8 May 2006 19:11:02 -0700, JMB
wrote:

A small variation, array entered

=SUMSQ(ROW(INDIRECT("1:"&A1)))


Thanks JMB, but your version just returns '1' whatever! I'll try and
figure out what's wrong, ok.

Cheers,
Shankley


"Peo Sjoblom" wrote:

One way where A1 holds n

=SUMPRODUCT(ROW(INDIRECT("1:" & A1))^2)


--

Regards,

Peo Sjoblom

http://nwexcelsolutions.com



"Shankley" wrote in message
...
Basically, I need to do a Sum of the Squares of the first 'n' Natural
Numbers. Something like:

function_name(n)

If 'n' is 8 say, then the function would return 204.

Thats 1*1 + 2*2 + 3*3 + 4*4 + 5*5 + 6*6 + 7*7 + 8*8

Likewise if 'n' is 6 say, then the function would return 91!

Or, if no funtion possible, is it possible to do the calculation with
conventional methods?

Thanks,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz




-
FunaxyrlRap-nocnglnubbqbgpbz


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shankley
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

On Mon, 8 May 2006 18:49:10 -0400, "Dana DeLouis"
wrote:

Hi. If your number is in A1, then perhaps...

=A1*(1 + A1)*(1 + 2*A1)/6


Thanks very much Dana DeLouis, it worked a treat, and now I'll just
try figure out why :)

Cheers,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shankley
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

On Mon, 8 May 2006 16:01:29 -0700, "Peo Sjoblom"
wrote:

One way where A1 holds n

=SUMPRODUCT(ROW(INDIRECT("1:" & A1))^2)



Peo Sjoblom,

Thanks very much, it works fine, and now I'll just try figure out why
:)

Cheers,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dana DeLouis
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

=SUMSQ(ROW(INDIRECT("1:"&A1)))
I'll try and figure out what's wrong, ok.


Hi. JMB's equation worked ok for me. It's an array equation, so enter the
equation with Ctrl+Shift+Enter. (Not just Enter).
The function "Sumproduct" does not need to be array-entered.
Just note that with these functions, 'n is limited to the number of Rows on
a sheet. Currently at 65536. With the direct equation, n is limited to
144224. (and 3408917801 using vba)

--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"Shankley" wrote in message
...
On Mon, 8 May 2006 19:11:02 -0700, JMB
wrote:

A small variation, array entered

=SUMSQ(ROW(INDIRECT("1:"&A1)))


Thanks JMB, but your version just returns '1' whatever! I'll try and
figure out what's wrong, ok.

Cheers,
Shankley


"Peo Sjoblom" wrote:

One way where A1 holds n

=SUMPRODUCT(ROW(INDIRECT("1:" & A1))^2)


--

Regards,

Peo Sjoblom

http://nwexcelsolutions.com



"Shankley" wrote in message
...
Basically, I need to do a Sum of the Squares of the first 'n' Natural
Numbers. Something like:

function_name(n)

If 'n' is 8 say, then the function would return 204.

Thats 1*1 + 2*2 + 3*3 + 4*4 + 5*5 + 6*6 + 7*7 + 8*8

Likewise if 'n' is 6 say, then the function would return 91!

Or, if no funtion possible, is it possible to do the calculation with
conventional methods?

Thanks,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz



-
FunaxyrlRap-nocnglnubbqbgpbz



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shankley
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

On Tue, 9 May 2006 03:18:46 -0400, "Dana DeLouis"
wrote:

=SUMSQ(ROW(INDIRECT("1:"&A1)))

I'll try and figure out what's wrong, ok.


Hi. JMB's equation worked ok for me. It's an array equation, so enter the
equation with Ctrl+Shift+Enter. (Not just Enter).
The function "Sumproduct" does not need to be array-entered.
Just note that with these functions, 'n is limited to the number of Rows on
a sheet. Currently at 65536. With the direct equation, n is limited to
144224. (and 3408917801 using vba)


Hi Dana,

thanks for the feedback, I tried the Ctrl+Shift+Enter, and it worked
fine!

Thanks again to everyone,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB
 
Posts: n/a
Default <REQ Can anyone help me build a function, please read....

More on Sumproduct. Much of its usefulness is not documented in Excel help
file.

http://www.xldynamic.com/source/xld.SUMPRODUCT.html

"Shankley" wrote:

On Tue, 9 May 2006 03:18:46 -0400, "Dana DeLouis"
wrote:

=SUMSQ(ROW(INDIRECT("1:"&A1)))
I'll try and figure out what's wrong, ok.


Hi. JMB's equation worked ok for me. It's an array equation, so enter the
equation with Ctrl+Shift+Enter. (Not just Enter).
The function "Sumproduct" does not need to be array-entered.
Just note that with these functions, 'n is limited to the number of Rows on
a sheet. Currently at 65536. With the direct equation, n is limited to
144224. (and 3408917801 using vba)


Hi Dana,

thanks for the feedback, I tried the Ctrl+Shift+Enter, and it worked
fine!

Thanks again to everyone,
Shankley
-
FunaxyrlRap-nocnglnubbqbgpbz

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
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
VBA function for "Mean" using Array as argument ASokolik Excel Worksheet Functions 21 March 28th 06 10:05 PM
clock Wildman Excel Worksheet Functions 2 April 26th 05 10:31 AM
Need a ISWorkday Function -- Any Ideas Mark Excel Worksheet Functions 5 March 29th 05 01:58 AM
Hyperlinks using R[1]C[1] and offset function in its cell referenc Elijah-Dadda Excel Worksheet Functions 0 March 5th 05 03:31 AM


All times are GMT +1. The time now is 08:08 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"