Solved

What is Access Equivalent of RSQ Function in Excel?

Posted on 2006-10-19
4
666 Views
Last Modified: 2012-06-27
Hi All --

My niece called me (her Auntie Access Developer) asking me how to do a RSQ in Access... I found a bit of info on Pearson's Correlation, but it was a bit dated.

Can anyone tell me how to do this?  She says, " We have the known X and Y values but cannot figure out how to use the RSQ function in Access that Excel has.  It would also be helpful if we could calculate both the linear and logarithmic r-squared value. "

Kids are so smart these days...

Thanks in advance!

Ronda
0
Comment
Question by:Ronda-S
  • 2
4 Comments
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 50 total points
ID: 17771707
I am now aware of any. Unless your excellent in School Maths :) u could code it yourself

I just checked wikipedia - Blimey!!!   http://en.wikipedia.org/wiki/Correlation


Alternative is to graph in Excel then use excel automation to calculate it. Nasty though, not fun sorting out graphs in excel via automation. I havent done that before
0
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 450 total points
ID: 17772233
Sorry - don't know anything about maths... (ahem.. looks nervously around the room incase anyone realizes and *makes* me do it :-S)

:-p
As interesting as evaluating that function (maths function as opposed to VBA) could be - I'd look to avoid the work - and just reference the Excel function from Access.

Function fGetExcelRSQ(arrX, arrY)

    Dim objExcel As New Excel.Application
   
    fGetExcelRSQ = objExcel.WorksheetFunction.RSq(varrX, varrY)
   
    objExcel.Quit
    Set objExcel = Nothing
   
End Function

For it to be truly useful on a performance level though - you'd really want to have the Excel object as a module level object variable - that's opened and persisted as long as necessary for each subsequent call - and then just use the function whenever you wanted.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17772245
LPurvis has given the example of what I was talking about - excel automation
I actually thought it would be more complicated, oh well

Just to add to LPurvis's post, u had better add a reference to Microsoft Excel object library or use latebinding - create as object
0
 

Author Comment

by:Ronda-S
ID: 17789564
Thanks to both of you for your post -- I appreciate the input.

I'll pass this on... although I still don't know what the *&%! Pearson's Coefficient is supposed to ultimately do, I did learn something out of this for myself:  I have worked with some basic Excel automation, I didn't know you could create an Access function based on an Excel Function like you did, LPurvis.  I'll have to play around with that one... maybe with an Excel function I understand!

;-) Ronda
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now