I am looking to customize the QUARTILE function to automate the selection of value range satisfying a specific condition.
https://drive.google.com/file/d/0B9uhATNT4QB2X1ZjNWlSYTFPMHc/view?usp=sharing
https://drive.google.com/file/d/0B9uhATNT4QB2WUktTktsR19wQjA/view?usp=sharing
I am able to filter column C which matches Priority P2 and able to select the corresponding values of Cloumn B.
The selection works in Sub, but strangely not working in Function.
However in both Function and Sub, I am not able to make the Quartile function work on this range.
Please suggest if I need to use any other means to realize this? OFFSET ??
https://drive.google.com/file/d/0B9uhATNT4QB2X1ZjNWlSYTFPMHc/view?usp=sharing
https://drive.google.com/file/d/0B9uhATNT4QB2WUktTktsR19wQjA/view?usp=sharing
I am able to filter column C which matches Priority P2 and able to select the corresponding values of Cloumn B.
The selection works in Sub, but strangely not working in Function.
However in both Function and Sub, I am not able to make the Quartile function work on this range.
Please suggest if I need to use any other means to realize this? OFFSET ??
Code:
Function CustQuart(Priority As Range) As Double
Dim xPriority As String
xPriority = Priority.Value
ActiveWorkbook.Worksheets("INs").Range("A1:D1").AutoFilter Field:=3, Criteria1:="P2"
ActiveWorkbook.Worksheets("INs").Range("B2").Select
ActiveWorkbook.Worksheets("INs").Range(Selection, Selection.End(xlDown)).Select
CustQuart = WorksheetFunction.Quartile_Inc(Arg1:=ActiveWorkbook.Worksheets("INs").Range(Selection, Selection.End(xlDown)).Select, Arg2:=1)
ActiveWorkbook.Worksheets("INs").Range("A1").AutoFilter
End Function