Consulting

Results 1 to 5 of 5

Thread: statistical function using VBA

  1. #1
    VBAX Regular
    Joined
    May 2005
    Posts
    75
    Location

    statistical function using VBA

    Hello!

    I would like to know if it's possible to use this statistical function"LOGNORMDIST"
    directly into my VBA code

    (LOGNORMDIST returns the cumulative lognormal distribution of x, where ln(x) is normally distributed with parameters mean and standard_dev)

    Thanks in advance,

    Regards,

    Fran?ois

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I have no idea how LOGNORMDIST works, but you could use Evaluate, like

    myval = Evaluate("LOGNORMDIST(4,3.5,1.2)")
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    May 2005
    Posts
    75
    Location
    another idea maybe?

    LOGNORMDIST is rather complex, with 2 parameters.

    I am able to use "Evaluate" with VBA
    For example, my code contains already some instructions like this:


    Dim iLastRow As Long
     Dim i As Long
     For i = 2 To iLastRow
            sFormula = "SQRT((N" & i & "))"
            Cells(i, "O").Value = Evaluate(sFormula)
    Next i



    But with LOGNORMDIST, it's different because 2 parameters
    have to be used (mean and standard_dev)
    These parameters can be calculated separately in two news columns
    But how could I integrate theses values into sFormula?

    Regards,

    Fran?ois

  4. #4
    VBAX Regular
    Joined
    Jul 2005
    Posts
    74
    Location
    This is an Excel application function w/o a VBA equivalent.
    How about simply

    Application.WorksheetFunction.LogNormDist(whatever)

  5. #5
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    Tested and it works:

    WorksheetFunction.LogNormDist(x, mean, stdev)
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •