简体   繁体   English

查找第 2、3、..n 次匹配并从最小到最大值返回排序结果?

[英]Lookup for 2nd, 3rd, ..nth match and return sorting results from smallest to largest values?

I have tried searching on google but I didn't find the solution yet.我试过在谷歌上搜索,但我还没有找到解决方案。 I would like to lookup the value that match with conditions and return result with sorting from small to large.我想查找与条件匹配的值并返回从小到大排序的结果。 What formula should i use to do this?我应该使用什么公式来做到这一点? Thank you very much.非常感谢。

在此处输入图片说明

I would use the SMALL function of Aggregate:我会使用 Aggregate 的 SMALL 函数:

=IFERROR(AGGREGATE(15,6,$B$2:$B$10/
(($A$2:$A$10=$D2)*($B$2:$B$10>=TIME(7,0,0))*($B$2:$B$10<=TIME(10,0,0))),COLUMN(A1)),"")

在此处输入图片说明

To retrieve multiple matching values from a set of data with a formula, you can use the IF and SMALL functions to figure out the row number of each match and feed that value back to INDEX.要使用公式从一组数据中检索多个匹配值,您可以使用 IF 和 SMALL 函数来计算每个匹配的行号并将该值反馈给 INDEX。

{=INDEX(array,SMALL(IF(vals=val,ROW(vals)-ROW(INDEX(vals,1,1))+1),nth))}

Where:在哪里:

  • array: 1 column range containing the results -> Column: B:B数组:包含结果的 1 列范围 -> 列:B:B
  • vals: 1 column lookup array -> Column: A:A vals: 1 列查找数组 -> 列:A:A
  • val: lookup value -> Column: D:D val:查找值 -> 列:D:D
  • nth -> Change row 1 values to 1,2,3,4 etc. instead of 1st, 2nd 3rd...第 n 个-> 将第 1 行的值更改为 1,2,3,4 等,而不是第 1、第 2、第 3...

As always when working with array formulas, use ctrl+shift+enter instead of normal enter与使用数组公式时一样,使用 ctrl+shift+enter 而不是正常的 Enter

If you have duplicate values in Time column, the following array formula can help :如果Time列中有重复值,以下数组公式可以提供帮助:

{=IFERROR(SMALL(IF(($D2=$A$2:$A$12)*($B$2:$B$12>=TIME(7,0,0))*($B$2:$B$12<=TIME(10,0,0)),IF(COUNTIF($D2:D2,$B$2:$B$12)=0,$B$2:$B$12)),1),"")}

Array formula after editing is confirmed by pressing ctrl + shift + enterctrl + shift + enter确认编辑后的数组公式

在此处输入图片说明

If you have O365 with the UNIQUE function, you can use:如果您有带有UNIQUE功能的O365 ,您可以使用:

D2: =UNIQUE(Name) 'to generate the list of names

E2: =IFERROR(SMALL(FILTER(Name:Time,(Name=$D2)*(Time>=TIME(7,,))*(Time <=TIME(10,,))),COLUMNS($A:A)),"")

Select E2 and copy across and down选择E2并上下复制

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 递增以返回第二、第三大数字的 MAXIFS 函数 - MAXIFS function that increments to return 2nd,3rd largest numbers 数组公式,根据两个单词中的任意一个查找第一,第二,第三大值 - Array Formula to find 1st, 2nd, 3rd Largest Values based on Either of Two Words 检索特定的单元格,当另一个单元格最大,第二大和第三大时 - Retrieve specific cell, when another cell is largest, 2nd largest and 3rd largest 从第二列搜索第一列的值,如果匹配则返回第三列的值 - Searching 1st column's value from 2nd col and returning 3rd col value if match 基于第一列和第二列的值的第三列 - 3rd column based on values of the 1st & 2nd column 如何使用索引和匹配概念从第二行和第三列或第一行和第四列中检索值,依此类推 - How to use index and match concept to retrieve values from 2nd row and 3rd column or 1st row and 4th column and so on VBA在一列中找到第一,第二,第三和第四大单元格以进行条件格式化 - VBA locating the 1st, 2nd, 3rd and 4th largest cells in a column for conditional formatting Excel 2010-从一张纸中取出整行,并根据第三张纸中的匹配内容在第二张纸中显示它们 - Excel 2010 - Take whole rows from one sheet and display them in the 2nd sheet based on match in 3rd sheet 如何从列中返回1st 2nd…nth非空白值以及之前和之后的列中的值 - How to return 1st 2nd…nth not blank value from column and values from column before and after 每隔第二行和第三行转置 - Transpose every 2nd and 3rd line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM