Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports

# Thread: Quartile Function In VBA

1. I agreed to these rules
Join Date
1st August 2008
Posts
3

## Quartile Function In VBA

Hi All,

Im looking to use vba to determin upper and lower quartiles, i know how to do this through excel "QUARTILE(B9:B59990,1)", but was wondering if anyone would of any code to do this in visual basic?

Thanks

VBA_Worker2

Excel Video Tutorials / Excel Dashboards Reports

2. Super Moderator
Join Date
18th November 2004
Location
God's Own Country
Posts
4,648

## Re: Quartile Function In Visual Basic (vb)

Hi VBA_Worker2,

Welcome to board!

This works for me

VB:
```Dim Ary, wf As WorksheetFunction
Ary = Array(5, 4, 9, 1, 6)

Set wf = Application.WorksheetFunction
MsgBox wf.Quartile(Ary, 1)

```
HTH

3. I agreed to these rules
Join Date
1st August 2008
Posts
3

## Re: Quartile Function In VBA

Thanks Krishnakumar

this is brilliant.
Last edited by Dave Hawley; August 2nd, 2008 at 10:14.

Excel Video Tutorials / Excel Dashboards Reports

4. I agreed to these rules
Join Date
6th February 2016
Posts
1

## Re: Quartile Function In Visual Basic (vb)

Originally Posted by Krishnakumar
Hi VBA_Worker2,

Welcome to board!

This works for me

VB:
```Dim Ary, wf As WorksheetFunction
Ary = Array(5, 4, 9, 1, 6)

Set wf = Application.WorksheetFunction
MsgBox wf.Quartile(Ary, 1)

```
HTH

I found that "Evaluate(Application.WorksheetFunction.Quartile(oRngTemp, 4)" fails when the range' local address "oRngTemp.AddressLocal" has \$ in the address, i.e \$BC\$13:\$BC\$17. Not all cells are evaluated to find desired statistic.

Excel Video Tutorials / Excel Dashboards Reports

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

#### Posting Permissions

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