简体   繁体   English

基于多个条件的查找值

[英]Lookup Value based on multiple criteria

Good day everyone - I am trying to create a grade sheet for my swimming classes at school. 大家好,我正在努力为学校游泳课创建成绩表。 It needs to be based on a few criteria - 1. boys/girls, 2. What stroke, 3. Time swum 它需要基于一些标准-1.男孩/女孩,2.什么中风,3.时间游泳

I have a column for Time swum and a column with a dropdown of boys freestyle, girls freestyle etc to choose from. 我有一个时间游动专栏和一个包含男孩自由泳,女孩自由泳等的下拉列表供您选择。 Then a criteria table where you get 30 point for swim x time less for each stroke for boys and girls. 然后是一个标准表,其中男孩和女孩每次游泳可获得30点游泳时间减少x时间。 I was trying to use index match - but that will only return one of the strokes. 我试图使用索引匹配-但这只会返回笔画之一。 As seen in the image - I need Column X to return the Points from column AB based on Column T dropdown selection, based on the range of the table with all the stroke times. 如图中所示-我需要X列以基于T列的下拉选择基于列表的所有笔划时间从AB列返回点。

I've gotten this far : =index(AB2:AB6,MATCH(S2,AG2:AG6,1)), but that assumes all are swimming backstroke and all are girls. 我到目前为止:= index(AB2:AB6,MATCH(S2,AG2:AG6,1)),但是假设所有人都仰泳,而且都是女孩。

I am hoping I am explaining this effectively enough. 我希望我能足够有效地解释这一点。

Thanks in advance for the help. 先谢谢您的帮助。

样本页面

You can use OFFSET to move the column you are matchin to the right. 您可以使用OFFSET将您要匹配的列向右移动。 Also my understanding is that is for example in column "Freestyle Girls" someone reaches time 50 she should be put into line 55 - Grade A, 25 Points. 我的理解也是,例如,在“自由式女孩”列中,某人达到时间50,则应将其置于第55行-A级,满分25分。 If so you will need to do this: 如果是这样,您将需要执行以下操作:

1) reverse order of your data lines - if you want to use MATCH with last parameter "-1" (returns lowest value greater or equal to lookup value) for time (when you reach 50, you are worse then 40 so you will go to line with 55) you will need to have the values in descending order so the grades will go D to A* instead of A* to D. 1)颠倒您的数据线顺序-如果您想对时间使用最后一个参数“ -1”(返回的最小值等于或大于查找值)的MATCH(当您达到50时,则恶化到40,因此您将继续)以55开头),您将需要按降序排列这些值,这样成绩将由D变为A *,而不是A *变为D。

2) use formula 2)使用公式

=IFERROR(INDEX(AB:AB,MATCH(S2,OFFSET(AB:AB,0,MATCH(T2,AC1:AF1,0)),-1)),AB2)

Basically what it does is this: 基本上它是做什么的:

OFFSET(AB:AB,0,MATCH(T2,AC1:AF1,0))

this moves the search column for the final MATCH to match the style you select 这将移动最终MATCH的搜索列以匹配您选择的样式

INDEX(AB:AB,MATCH(S2,OFFSET(...),-1))

this is standard search like you tried, only the OFFSET is inside so it looks in correct column. 这是您尝试的标准搜索,只有OFFSET在其中,因此它显示在正确的列中。

As there is no value above Grade D it would cause error if somone nearly drowned and took 100 to finish so you need IFERROR to make sure it correct that. 由于没有高于D级的值,如果somone几乎淹死并花了100秒钟完成,则将导致错误,因此您需要IFERROR来确保正确。

Note : this assumes that value in T matches the values in the column names AC-AH. 注意 :这假定T中的值与列名称AC-AH中的值匹配。 It your example the word order seems flipped. 在您的示例中,单词顺序似乎发生了变化。 Also I put into my formula only 4 different styles so you will need to change the part stating AC1:AF1 to contain all the styles 另外,我在公式中仅输入了4种不同的样式,因此您需要更改说明AC1:AF1的部分以包含所有样式

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM