Google Sheet: How to find Highest Value along with the date for given set of data(date-value pair) in Google Sheet Formula?

怎甘沉沦 提交于 2021-01-28 05:01:48

问题


I have below data in date-value pair format in Google Sheet:

Date Value
1/8/2021 1301.85
1/11/2021 1303.9
1/12/2021 1320.05
1/13/2021 1291.55
1/14/2021 1287.45
1/15/2021 1270

I'm looking for a google sheet formula that will return output: highest value along with its associated date. That means I'm trying to get the output as below: 1/12/2021 1320.05


回答1:


You can also use the SORTN function.
The difference being, by using an INDEX formula you need to re-format the column A result to a date while using SORTN you don't.

=SORTN(A2:B,1,0,2,0)

How the SORTN function in our formula works

  • 1 is "the number of items to return" (since we need just the max we set it to 1)
  • 0 "Shows at most the first n rows" (this is the so called ties_mode, in our case 0)
  • 2 is "the index of the column containing the values to sort by" which here is the 2nd column
  • 0 "indicates how to sort the sort_column. TRUE (or 1) sorts in ascending order. FALSE (or 0) sorts in descending order".



回答2:


try this:

=INDEX(SORT(A2:B), 2, 0), 1)



回答3:


Another approach:

=index(A2:B,match(max(B2:B),B2:B,0))

Like this answer, you don't need to reformat the date.



来源:https://stackoverflow.com/questions/65757817/google-sheet-how-to-find-highest-value-along-with-the-date-for-given-set-of-dat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!