How to use lookup function to find the MAX number in a column

  • 27 September 2021
  • 1 reply
  • 273 views

I have a form that calculates total sales

EmployeeName | TotalSales

 

I want to display the top seller(EmployeeName) and total (TotalSales) on form load when a new entry is made

 


1 reply

Badge +8

You can do a lookup returning multiple values by providing true at the end of the formula. So given that each employee only occurs once in your list, you could get the max-total-sales  this way using two lookups:


lookup("your-list","totalSales",max(lookup("your-list","active",true,"totalSales",true)),"Person")

This will give you the person with the highest "totalSales" value in "your-list". I had to work in a filter for the inner lookup to look at only "active" elements as you can´t do lookups without a filter. 


Outter lookup is responsible to get a person filtered by totalSales


Inner lookup gets the highest totalSales number.


 


Hope this helps!

Reply