Here is a JMP Function using the exact methodology used in the Excel function, PERCENTILERANK as described in the MicroSoft Excel help page
https://support.microsoft.com/en-us/office/percentrank-function-f1b5836c-9619-4847-9fc9-080ec9024442
Below I have provided the example table from the help page, along with the JMP function I created
Names Default To Here( 1 );
New Table( "Excel Example",
Add Rows( 10 ),
New Column( "Data",
Numeric,
"Nominal",
Format( "Best", 12 ),
Set Values( [13, 12, 11, 8, 4, 3, 2, 1, 1, 1] )
)
);
dt = Current Data Table();
percentRank = Function( {col, value},{default local},
mydt = Current Data Table();
theValue = .;
theRows = mydt << get rows where( As Column( mydt, col ) == value );
If( N Rows( theRows ) > 0,
gt = Col Number( If( As Column( mydt, col )[Row()] > value, Column( mydt, col )[Row()], . ) );
lt = Col Number(
If( As Column( mydt, col )[Row()] < value & Is Missing( As Column( mydt, col )[Row()] ) == 0,
As Column( mydt, col )[Row()],
.
)
);
theValue = lt / (lt + gt);
,
lower = upper = .;
lower = Col Max( If( As Column( mydt, col ) < value & Is Missing( As Column( mydt, col )[Row()] ) == 0, Column( mydt, col )[Row()], . ) );
upper = Col Min( If( As Column( mydt, col ) > value, Column( mydt, col )[Row()], . ) );
// get the percentileRank for upper and lower
upperPR = percentRank(col,upper);
lowerPR = percentRank(col,lower);
intervalPCT=(value-lower)/(upper-lower);
theValue = lowerPR+(intervalPCT*(upperPR-lowerPR));
);
Return( theValue );
);
x = percentRank( "data", 8 ); // a data point found in the data
show("found in table",x);
x = percentRank( "data", 5 ); // a data point not found in the data
show("Not found in table",x);
Jim