Share via

Access VBA Statistics

Anonymous
2016-02-27T01:29:41+00:00

If I enter the following within Access VBA I get the correct answer (18.307), so I'm set-up to use Excel functions in Access:

            MsgBox Excel.Application.ChiInv(0.05, 10)

I'm trying to access Excel's LINEST statistical function from Access VBA. Every example I've seen uses Excel cell ranges (say A1:A21) whereas I'm trying to analyse data from an Access table.

How do I insert a data sequence into the LINEST function? At the simplest level, Excel will calculate that LINEST of 30, 32, 34 is 2.000. How can I enter those values in Access VBA, either as reference to a sequence of query values or as a code-created string?

Peter

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2016-02-28T03:53:19+00:00

    That's awesome. I tried the Array() function and had no success. Glad to hear you got it working.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-02-27T23:00:38+00:00

    Tom

    Thanks. I've played around with some work-arounds and found that if I (a) dimension an array (say Dim x()), (b) populate that array with values extracted from an Access table and then (c) use the array value in the Excel formula, it comes up with the answer: Excel.Application.LinEst(x)

    Peter

    Was this answer helpful?

    0 comments No comments
  3. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2016-02-27T22:24:41+00:00

    You cannot, because you cannot enter cell references that are required by this function.

    Linear regression is not that hard. Bing for "vba linear regression" and you will find several promising leads.

    Was this answer helpful?

    0 comments No comments
  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more