简体   繁体   English

Excel公式Vlookup通过引用行和列的值

[英]Excel Formula Vlookup the value by referring Row and Column

In the sheet1 i have a table called working days of the countries as shown in the below image. 在sheet1中,我有一个表格,称为各国家的工作日,如下图所示。

在此处输入图片说明

In the Sheet2 i have 10 columns in that based on the country and month by referring the this table i am trying to populate the values, When i tried doing by Vlookup the first row alone getting populated, but in the second row the header from F1:T1 is getting changed to F2:T2 so rest of the cells showing as #NA . 在Sheet2中,通过引用此表,我基于国家和月份在该字段中有10列,我尝试填充值。当我尝试通过Vlookup进行操作时,仅填充第一行,但是在第二行中,则是F1:T1的标题F1:T1更改为F2:T2因此其余单元格显示为#NA

在此处输入图片说明

Anyone can you please give a solution for my issue. 任何人都可以解决我的问题。 Here is the formula i have used. 这是我使用的公式。

=VLOOKUP(I1,Sheet1!F2:T7,MATCH(Sheet2!M1,Sheet1!F1:T1,0))

Thanks in Advance. 提前致谢。

You are missing the symbol $ to lock the ranges, and the false condition to match exact values in the VLOOKUP . 您缺少用于锁定范围的符号$和用于匹配VLOOKUP中的精确值的错误条件。

It should be like: 应该是这样的:

=VLOOKUP(I1,Sheet1!$F$2:$T$7,MATCH(M1,Sheet1!$F$1:$T$1,0),0)

Or instead of VLOOKUP use HLOOKUP like: 或者代替VLOOKUP使用HLOOKUP例如:

=HLOOKUP(M1,Sheet1!$F$1:$T$7,MATCH(I1,Sheet1!$F$2:$F$7,0),0)

In general, combining the INDEX and MATCH functions is a superior option to VLOOKUP . 通常,结合INDEXMATCH函数是VLOOKUP的高级选择。 For example, =INDEX(Sheet1!F:F,MATCH(Sheet2!M1,Sheet1!F1:T1,0)) . 例如=INDEX(Sheet1!F:F,MATCH(Sheet2!M1,Sheet1!F1:T1,0)) This allows you to go left-to-right or right-to-left as well. 这也使您可以从左到右或从右到左移动。

Snip for Index Match functions Using Vlookup won't work here because in the 2nd table you are repeating the country, unlike the first table. 索引匹配功能的代码段在这里无法使用Vlookup,因为与第二张表不同,在第二张表中您要重复输入国家/地区。 Use a combination of index match function, this is little trickier than the vlookup but it will fulfill your requirements. 结合使用索引匹配功能,这比vlookup复杂,但可以满足您的要求。

Since I don't have the exact table you shared so I created a table on my end and sharing the snip here. 由于我没有您共享的确切表,因此我在一端创建了一个表并在此处共享该片段。

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

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