+ Reply to Thread
Results 1 to 5 of 5

Chi Square Function conversion to VBA

Hybrid View

  1. #1
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,522

    Chi Square Function conversion to VBA

    Hi Guys

    I am unable to convert this function formula to VBA ... please advise ...
    Formula: copy to clipboard
    =2*MIN(_xlfn.CHISQ.DIST(H33,H28-1,1),1-_xlfn.CHISQ.DIST(H33,H28-1,1))

    Below code ... have substituted the Cells with Variables...

    Pval = 2 * Application.WorksheetFunction.Min(WorksheetFunction.Chisq_Dist(Xstat,Size-1,1),1 - WorksheetFunction.Chisq_Dist(Xstat,Size-1,1))
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,343

    Re: Chi Square Function conversion to VBA

    Two issues:

    1. The fact that you are seeing _xlfn. at the start of the function name, means it doesn't exist in your version of Excel. (it was added in 2010 I think)
    2. You misspelled it in the code as Chisqu_Dist

    The first one is obviously the more serious issue.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,522

    Re: Chi Square Function conversion to VBA

    True ... Gives runtime error 1004 Unable to get Chisq_Dist property of WorksheetFunction class
    Edit...Newbie Error did not even look at error msg

    Just realized that the code is good ... Error is in values ....Xstat was incorrect
    Last edited by Sintek; 08-30-2018 at 05:18 AM.

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,522

    Re: Chi Square Function conversion to VBA

    Hi rorya

    Thanks for reply...Yes does not exist in 2007...Am using 2013 to develop Add in though...
    Have now opened file in 2013 and the -xlfn, not present ...
    You misspelled it in the code as Chisqu_Dist
    Noticed that tx ...

    Not the issue though...
    Last edited by Sintek; 08-30-2018 at 04:43 AM.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,343

    Re: Chi Square Function conversion to VBA

    Well, you haven't really given any information as to the problem!

    Also, just to be clear, developing the add-in in 2013 will not make it work in 2007.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Function for the n'th square root
    By Saturn in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2016, 10:31 AM
  2. [SOLVED] convert square meters to square feet
    By mroberts in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-07-2013, 12:51 PM
  3. Square footage to board feet conversion
    By RBCC in forum Excel General
    Replies: 2
    Last Post: 12-17-2011, 10:53 PM
  4. Replies: 1
    Last Post: 08-12-2010, 05:00 PM
  5. Replies: 3
    Last Post: 08-19-2009, 08:53 AM
  6. how to center a square plot area in a square chart
    By xppuser in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-11-2006, 04:20 AM
  7. [SOLVED] Regression Output -- R Square versus Adjusted R Square
    By Bonnie in forum Excel General
    Replies: 1
    Last Post: 10-24-2005, 08:05 PM

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