ContributionsMost RecentMost LikesSolutionsRe: Is there a way to get a value based on comparing 3 different fields across all records and then combining the results for a total ranking? https://login.quickbase.com/db/6ewwzuuj?a=td Category = Query Regards, Elwyn Dow Solutions Architect Sympo, Inc.|168 E. Arrow Highway|Suite 100|San Dimas, CA 91773 Re: Is there a way to get a value based on comparing 3 different fields across all records and then combining the results for a total ranking?Ranking formula using the new Query functions. Will rank records based on numeric field. Ranks top 10, top 100, etc – or every value… var bool descOrder= true;// true if ranking from high to low, otherwise false var number maxrank= 0;// 0 to rank every number, else 10 to rank 1 through 10, 100 to rank 1 through 100, etc var number fieldId = 17;// the field id of the numeric field being ranked - CHANGE AS NEEDED var number rankThis = [number field];// the numeric field being ranked - CHANGE AS NEEDED var number rank= If($descOrder, Size(GetCellValues(GetRecords("{"&$fieldId&".GT."&$rankThis&"}"),$fieldId))+1, Size(GetCellValues(GetRecords("{"&$fieldId&".LT."&$rankThis&"}"),$fieldId))+1); If($maxrank=0,$rank, If($rank<=$maxrank,$rank,null)) ------------------------------ Elwyn Dow ------------------------------ Re: Is there a way to rank values in quickbase similar to Excel's RANK function?Ranking formula using the new Query functions. Will rank records based on numeric field. Ranks top 10, top 100, etc – or every value… var bool descOrder= true;// true if ranking from high to low, otherwise false var number maxrank= 0;// 0 to rank every number, else 10 to rank 1 through 10, 100 to rank 1 through 100, etc var number fieldId = 17;// the field id of the numeric field being ranked - CHANGE AS NEEDED var number rankThis = [number field];// the numeric field being ranked - CHANGE AS NEEDED var number rank= If($descOrder, Size(GetCellValues(GetRecords("{"&$fieldId&".GT."&$rankThis&"}"),$fieldId))+1, Size(GetCellValues(GetRecords("{"&$fieldId&".LT."&$rankThis&"}"),$fieldId))+1); If($maxrank=0,$rank, If($rank<=$maxrank,$rank,null)) ------------------------------ Elwyn Dow ------------------------------ Re: Implementing a stack rank function?Ranking formula using the new Query functions. Will rank records based on numeric field. Ranks top 10, top 100, etc – or every value… var bool descOrder= true;// true if ranking from high to low, otherwise false var number maxrank= 0;// 0 to rank every number, else 10 to rank 1 through 10, 100 to rank 1 through 100, etc var number fieldId = 17;// the field id of the numeric field being ranked - CHANGE AS NEEDED var number rankThis = [number field];// the numeric field being ranked - CHANGE AS NEEDED var number rank= If($descOrder, Size(GetCellValues(GetRecords("{"&$fieldId&".GT."&$rankThis&"}"),$fieldId))+1, Size(GetCellValues(GetRecords("{"&$fieldId&".LT."&$rankThis&"}"),$fieldId))+1); If($maxrank=0,$rank, If($rank<=$maxrank,$rank,null)) ------------------------------ Elwyn Dow ------------------------------ Re: Formula for Record RankingThis formula will rank records based on a numeric field - uses the new Query category of Functions var bool descOrder= true;// true if ranking from high to low, otherwise false var number maxrank= 0;// 0 to rank every number, else 10 to rank 1 through 10, 100 to rank 1 through 100, etc var number fieldId = 17;// the field id of the numeric field being ranked - CHANGE AS NEEDED var number rankThis = [number field];// the numeric field being ranked - CHANGE AS NEEDED var number rank= If($descOrder, Size(GetCellValues(GetRecords("{"&$fieldId&".GT."&$rankThis&"}"),$fieldId))+1, Size(GetCellValues(GetRecords("{"&$fieldId&".LT."&$rankThis&"}"),$fieldId))+1); If($maxrank=0,$rank, If($rank<=$maxrank,$rank,null)) ------------------------------ Elwyn Dow ------------------------------