Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default calculate the average of a column then move it to excel

I have the following results after a sql query:

off_time mydata2
-------- --------
12:15 4.324
12:30 5.26
12:45 6.9654

using this sql statement:
select off_time, least(2+(0.044117*CT_OFF_GEN),8) as mydata2 from b_NRatio

Using the above sql how can I average the the mydata2 column and store it in
a variable? I then need to copy it to Excel like so:

ADO_rs.Open
ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVGOFmydata2

David



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default calculate the average of a column then move it to excel

This isn't standard SQL, but the AVG function is, so a guess:

select AVG(least(2+(0.044117*CT_OFF_GEN),8)) as AVGOFmydata2 from b_NRatio

--

"Aster99" wrote in message ...
I have the following results after a sql query:

off_time mydata2
-------- --------
12:15 4.324
12:30 5.26
12:45 6.9654

using this sql statement:
select off_time, least(2+(0.044117*CT_OFF_GEN),8) as mydata2 from b_NRatio

Using the above sql how can I average the the mydata2 column and store it in
a variable? I then need to copy it to Excel like so:

ADO_rs.Open
ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVGOFmydata2

David

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
Calculate weighted average for 1 column Jul2010 Excel Worksheet Functions 3 January 21st 10 04:29 PM
calculate average from non contiguous column, ignoring (0) values Jesse Excel Worksheet Functions 3 June 30th 09 10:41 PM
How can I use excel to calculate average annual ROI... pittsburgcat Excel Discussion (Misc queries) 4 May 20th 07 05:58 AM
calculate average in a column based on criteria in another column sharon t Excel Discussion (Misc queries) 2 May 12th 06 06:07 PM
hOW TO USE EXCEL TO CALCULATE BASEBALL BATTING AVERAGE golfer18 Excel Worksheet Functions 4 April 27th 05 05:11 AM


All times are GMT +1. The time now is 09:02 PM.

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"