简体   繁体   English

Excel-根据每个细分的值范围查找组

[英]Excel - Lookup the group based on value range per segment

I have a table like below. 我有一张如下表。

segmentnum  group 1 group 2 group 3 group 4
1           0       12      33      66
2           0       3       10      26
3           0       422     1433    3330

And a table like below. 和下面的表格。

vol     segmentnum  
0       1           
58      1           
66      1           
48      1           
9       2           
13      2           
7       2           
10      3           
1500    3           

I'd like to add a column that tells me which group the vol for a given segmentnum belongs to. 我想添加一列,告诉我给定segmentnum的卷属于哪个组。 Such that 这样

Group 1 = x to < group 2
Group 2 = x to < group 3
Group 3 = x to <= group 4

Desired result: 期望的结果:

vol     segmentnum  group
0       1           1
58      1           3
66      1           3
48      1           3
9       2           2
13      2           3
7       2           2
10      3           3
1500    3           3

Per the accompanying image, put this in I2 and drag down. 根据随附的图像,将其放在I2中并向下拖动。

=MATCH(G2, INDEX(B$2:E$4, MATCH(H2, A$2:A$4, 0), 0))

在此输入图像描述

While these results differ from yours, I believe they are correct. 尽管这些结果与您的结果有所不同,但我相信它们是正确的。

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

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