excel中vlookup

This article is for all excel wizards, conversant with majority of excel features and functions but have not realised the potential of Power Query for data extraction and transformation automations and ease of use.

本文适用于所有excel向导,已熟悉大多数excel特性和功能,但尚未意识到Power Query在数据提取和转换自动化以及易用性方面的潜力。

Power Query in itself is a powerful tool and needs mutiple articles to cover the features; however, this article will provide a brief and explain the use of Power Query to overcome the limitations of VLOOKUP, one of the most used function in excel. VLookup helps in deriving/sourcing the value from another table or sheet arranged vertically for lookup values in the current table. As an excel user, the first activity before performing any kind of analysis is — Data preparation and VLookup helps in sourcing the relevant data for analysis.

Power Query本身是一个功能强大的工具,并且需要多篇文章来介绍这些功能。 但是,本文将简要介绍并解释如何使用Power Query克服VLOOKUP的限制,VLOOKUP是excel中最常用的功能之一。 VLookup有助于从垂直排列的另一个表或工作表中获取/获取值,以在当前表中查找值。 作为excel用户,执行任何类型的分析之前的第一个活动是-数据准备和VLookup帮助提供相关数据以进行分析。

However, this function has its own challenges and limitations which can be easily resolved with Power Query or in other words Advanced VLookup can be performed using Power Query. But, lets start with the basics first!!

但是,此功能有其自身的挑战和局限性,可以通过Power Query轻松解决,换句话说,可以使用Power Query执行Advanced VLookup。 但是,让我们先从基础开始!!

What is Power Query and how it can help

什么是Power Query及其如何提供帮助

Power Query is a data preparation and transformation engine inbuilt in Microsoft Excel.With Power Query, the data extracion/sourcing and transformation tasks can be done with increased efficiency and can be automated without using any codes or functions, with just few clicks. Now, coming back to the issue in hand which is ‘how to overcome limitations of Vlookup’.

Power Query是Microsoft Excel中内置的数据准备和转换引擎,借助Power Query,数据提取/采购和转换任务可以提高效率,并且无需单击任何代码或功能即可自动执行。 现在,回到手头的问题,即“如何克服Vlookup的局限性”。

Vlookup局限性 (Vlookup Limitations)

Scenario 1: Vlookup can only look to the right-In the illustration below, there are two tables -Lookup Table(yellow) and Employee Salary Table(Red). In the Employee_Salary_Table, we need to obtain Name (First Name and Last Name) of the employee from the Lookup table on the basis of lookup values in Employee ID column in Employee_Salary_Table. This seems quite easy; however, VLookup can not be used in this case as the Name values (First Name and Last name) are stored in the columns to the left of Employee ID in the Lookup Table. This may see bizarre but Vlookup function can only be used to obtain values stored in the columns which are to the right of the matching columns in the Lookup Table.

方案1:Vlookup只能向右看-在下图中,有两个表-查找表(黄色)和员工薪水表(红色)。 在Employee_Salary_Table中,我们需要根据Employee_Salary_Table中Employee ID列中的查找值从Lookup表中获取员工的名字(名字和姓氏)。 这似乎很容易。 但是,在这种情况下,不能使用VLookup,因为名称值(名字和姓氏)存储在查找表中员工ID左侧的列中。 这可能看起来很奇怪,但是Vlookup函数只能用于获取存储在“查找表”中匹配列右侧的列中的值。

Image 1: Depiction of tables in Scenario1
图1:Scenario1中表的描述

Scenario 2: VLookup finds the first match in the Lookup table and return the corresponding value- In the image below, if details of the employees (First name, Last name and Employee ID) working in the departments specified in the Department Table is derived using VLookup functio,we would only obtain details of the employee first matched on the basis of Department. Vlookup would fail to provide details of all employees working in the department specified in the Department column in Department Table.

方案2: VLookup在“查找”表中找到第一个匹配项并返回相应的值-在下图中,如果使用“部门表”中指定的部门工作的雇员的详细信息(名字,姓氏和雇员ID)是使用VLookup功能,我们将仅根据部门获取首先匹配的员工的详细信息。 Vlookup将无法提供在“部门表”的“部门”列中指定的部门工作的所有员工的详细信息。

Image 2: Depiction of tables in Scenario 2
图2:方案2中的表描述

Scenario 3: VLookup can only look for one Lookup Column not mutliple lookup column combinations

方案3:VLookup只能查找一个查找列,而不能查找多个查找列组合

Image 3: Depiction of tables in scenario 3
图3:场景3中表的描述

In the above illustration, if we use VLookup to retrive value of Employee ID in the Employee_Table from the Lookup Table on the basis of First name, the employee ID for the employee with the same first name (E.g: Carol in the Employee_Table would be retruned as A001) would be returned as same; irrespective of their different last name. To get the correct result in this case, the lookup value should be a combination of First and Last name. However VLookup can only match values on the basis of one lookup column. We can use a workaround by concatinating the First and Last name but that would increase the complexity in large data and increase of processing time.

在上图中,如果我们使用VLookup根据名字从查找表中检索Employee_Table中Employee ID的值,则具有相同名字的员工的雇员ID(例如:Employee_Table中的Carol与A001相同)将返回; 不管他们的姓氏不同。 为了在这种情况下获得正确的结果,查找值应该是名字和姓氏的组合。 但是,VLookup只能根据一个查询列匹配值。 我们可以通过混用名字和姓氏来使用变通办法,但这会增加大数据的复杂性并增加处理时间。

Power Query to resolve these limitations:

使用Power Query解决这些限制:

Power Query can easily overcome these challenges of VLookup and offers much more flexibility in data sourcing/extraction. I would describe more Power Query features in my future articles but lets focus here on performing VLookup using Power Query!

Power Query可以轻松克服VLookup的这些挑战,并在数据源/提取方面提供更大的灵活性。 我将在以后的文章中介绍更多的Power Query功能,但在这里让我们重点介绍如何使用Power Query执行VLookup!

VLookup is essentially merging of data from two Tables/Sheets. Let’s see it through an example and take the scenario 1 where First name and Last name are to derived in the Employee_Salary_Table from the Lookup table. The process of merging these two tables would be as follows:

VLookup本质上是合并来自两个表/表的数据。 让我们通过一个示例进行查看,并采用场景1,其中,“姓氏”和“姓氏”将在Lookup表的Employee_Salary_Table中派生。 合并这两个表的过程如下:

  1. As Power Query works with Queries , first we need to convert both these tables into queries one by one.当Power Query与Queries一起使用时,首先我们需要将这两个表一张一张地转换成查询。
  2. We can start with any of the table. Here, I have started with Employee_Salary_Table, select it and click on Data tab> In the ‘Get & Transform Data section’, select the ‘From Table/Range’ icon as shown in the image below. This will open up the ‘Power Query Editor window’ and the table would automatically be converted to a Query. Here, any transformation required to the table data can also be done. Click Close & Load(Choose Create Connection Only).我们可以从任何表格开始。 在这里,我从Employee_Salary_Table开始,选择它并单击Data选项卡>在“ Get&Transform Data”部分中,选择“ From Table / Range”图标,如下图所示。 这将打开“ Power Query Editor窗口”,并且表格将自动转换为Query。 在这里,还可以对表数据进行任何所需的转换。 单击关闭并加载(仅选择创建连接)。
Image 4: Conversion of Tables to Queries
图4:将表转换为查询

3. Repeat the process with Lookup Table. Now we have two queries for these two tables (visible in the Queries & Connections Pane). From the ‘Get Data’, dropdown > select Combine Queries>Merge.

3.使用“查找表”重复该过程。 现在,我们对这两个表有两个查询(在“查询和连接”窗格中可见)。 从“获取数据”下拉菜单中,选择“合并查询”>“合并”。

Image 5: Merging of Queries
图片5:合并查询

4. Selecting ‘Merge’ would open up the Merge window as shown below. Choose the Queries one by one from the dropdown. It is better to select the table in which data to be sourced /derived as first. Choose the join kind, which by default would be Left Outer Join. Also select the column to be matched in both the tables . Here, I have selected ‘Employee ID’ in both the tables.

4.选择“合并”将打开“合并”窗口,如下所示。 从下拉列表中一一选择查询。 最好首先选择要在其中导出/导出数据的表。 选择联接类型,默认情况下为“左外部联接”。 同时在两个表中选择要匹配的列。 在这里,我在两个表中都选择了“雇员ID”。

Image 6: Merging of tables
图片6:合并表格

5. The joins work like in SQL and can be chosen as per your requirement from the available options — Left Outer Join, Right Outer Join, Full Outer Join, Inner Join, Left Anti and Right Anti.

5.联接的工作方式类似于SQL,可以根据需要从可用选项中选择-左外部联接,右外部联接,完全外部联接,内部联接,左反和右反。

6. On clicking ‘OK’ , the tables would be merged. Select the icon highlighed in the image below in the Lookup_Table header to select the columns that needs to be derived/sourced from Lookup Table. In our case, it is First name and Last Name. We can choose as many columns as required from the Lookup Table without the need to apply VLookup function multiple times.

6.单击“确定”,将合并表。 选择下图在Lookup_Table标头中高亮显示的图标,以选择需要从Lookup Table派生/派生的列。 在我们的例子中,它是名字和姓氏。 我们可以从“查找表”中选择所需的任意列,而无需多次应用VLookup函数。

Image 7
图片7

7. After Column selection in the Lookup_table, click Close& Load. The merged data will be opened in another sheet in the current workbook.

7.在Lookup_table中选择Column之后,单击Close&Load。 合并的数据将在当前工作簿的另一个工作表中打开。

8. The process explained here is applied for merging of tables in Power Query Editor and can be done as per the user requirement.

8.此处说明的过程适用于Power Query Editor中的表合并,并且可以根据用户要求完成。

Resolving other two limitations

解决其他两个限制

Case 2: To resolve the issue in scenario 2 in the VLookup limitation section, follow the same process in Power Query with only one change. Select Join Kind as ‘Right Outer’ which means select all values from the second table — ‘Lookup table’ in our case.

情况2:若要解决方案2在VLookup限制部分中的问题,请执行Power Query中的相同过程,而只需进行一次更改。 选择Join Kind作为“ Right Outer”,这意味着从第二个表中选择所有值,在本例中为“ Lookup table”。

Case 3: To resolve the issue in scenario 3 in the VLookup limitation section, follow the same process by selecting the columns — First Name and Last name in both the tables. The result would be generated by comparing the combination of values in First name and Last name column.

情况3:若要解决方案3中“ VLookup限制”部分中的问题,请选择两个表中的“名字”和“姓氏”列,以执行相同的过程。 通过比较“姓氏”和“姓氏”列中值的组合来生成结果。

Conclusion:

结论:

Power Query is a powerful and amazing tool that can automate the common data sourcing and transformation tasks in excel with increased efficiency and singificantly reduce the time spent on data preparation. It is also important to mention here, that all applied sourcing and transformation steps are recorded in Power Query and can be refreshed for new data in the tables. It is my recommendation to all excel users to learn and use Power Query as it is a powerful tool and significantly easy to learn.

Power Query是一个功能强大且令人赞叹的工具,可以提高效率自动执行excel中的常见数据源和转换任务,并显着减少花费在数据准备上的时间。 在此还必须提及的是,所有应用的采购和转换步骤都记录在Power Query中,并且可以刷新以获取表中的新数据。 我建议所有excel用户学习和使用Power Query,因为它是一个功能强大的工具,非常容易学习。

Therefore, continue on your learning path and realise the true power of Power Query!!

因此,继续您的学习之路,实现Power Query的真正力量!!

翻译自: https://medium.com/analytics-vidhya/overcome-limitations-of-vlookup-using-power-query-in-excel-6be4adcdb691

excel中vlookup


http://www.taodudu.cc/news/show-5524073.html

相关文章:

  • 借助 ONLYOFFICE 宏进行去重
  • 离线状态下如何在Execl中实现数据修改后的高亮显示?
  • EXCEL----数据处理(一)----找出两列数据(单列无重复)中的重复项并知道不重复部分的来源
  • Excel实用技巧记录
  • Excel按行高亮显示重复值
  • excel如何晒出重复数据_excel表格怎么晒出重复的?EXCEL如何使重复数据自动变红?...
  • Excel函数实现腾讯在线文档Excel会员功能——标记重复值
  • VBA:Excel选中单元格后,相同值高亮显示
  • thinkphp + 美图秀秀api 实现图片裁切上传,带数据库
  • pdf复制换行问题
  • php有一张一毫米的纸,cad单位怎么设置成毫米
  • cad单位_CAD中关于单位的 6 个知识,你用过吗?
  • cad单位_老司机帮您 win10系统设置cad画图比例的流程 -win10使用教程
  • autoCAD2022 - 设置新的原点
  • cad单位_CAD新手教程,如何设置绘图环境与图纸尺寸?
  • CAD 图形单位设置
  • 更改CAD的绘图单位及精度怎么操作??
  • 漫谈数据结构系列(二)之千里姻缘一“线”牵
  • bg感_请叫他们【BG之光】
  • 用计算机语言写结婚祝福语,抖音很火的结婚祝福语 祝福新人的唯美句子
  • 《我曾》火了:人这辈子,最怕突然听懂这首歌
  • 爱情小条串起的记忆
  • 用java写爱情,既然编制了一个梦,那就圆了它。
  • PCB设计,Altium Designer软件绘制一个stm32最小系统的电路原理图、PCB图。
  • 公众号万粉感言,抽3000元大奖!
  • 微信公众平台开发30分钟入门教程
  • 取消b站充电鸣谢!!!
  • B站up主排名丨B站2021年4月up主充电排行榜榜单发布!
  • 跳过B站充电鸣谢
  • B站榜单丨2021年5月B站UP主充电排行榜

excel中vlookup_在Excel中使用Power查询克服vlookup的局限性相关推荐

  1. excel函数:汉字转全拼_30天中30个Excel函数:01 –精确

    excel函数:汉字转全拼 Welcome to the Contextures 30 Excel Functions in 30 Days (30XL30D) challenge. Thanks f ...

  2. Excel中如何截取字符串中指定字符后的部分字符

    1.如何给某列属性为时间整体加一个时间值: 场景一:假如我有一个excel中的某一列如下图所示,如何将该列的时间(用B代替整列)整体加一分钟呢?方法很简单,在空白单元格填写时间格式图中A所示:复制单元 ...

  3. R语言write.xlsx函数将数据写入Excel文件:写入Excel文件并自定义表单的名称、将数据写入Excel文件新的表单(sheet)中、将文件保存为xls文件格式(而不是xlsx)

    R语言write.xlsx函数将数据写入Excel文件:写入Excel文件并自定义表单的名称.将数据写入Excel文件新的表单(sheet)中.将文件保存为xls文件格式(而不是xlsx) 目录

  4. 浅谈Excel开发:九 Excel 开发中遇到的常见问题及解决方法

    Excel开发过程中有时候会遇到各种奇怪的问题,下面就列出一些本人在开发中遇到的一些比较典型的问题,并给出了解决方法,希望对大家有所帮助. 一 插件调试不了以及错误导致崩溃的问题 在开发机器上,有时可 ...

  5. 实现Excel数据导入到SQL2005中的方法(回顾)

    一. 在程序中,用ADO.NET.代码如下:   //连接串 string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Prop ...

  6. 在VS2005中 GridView导入Excel的两点小技巧-附源码

    VS2005中 GridView导入Excel的导入需要注意的几点 最近带的项目遇到GridView导入Excel问题,总结出几点: 1.如果出现下面的错误提示可用重载VerifyRenderingI ...

  7. C#中实现对Excel特定文本的搜索

    打开Excel的VBA帮助,查看Excel的对象模型,很容易找到完成这个功能需要的几个集合和对象: Application.Workbooks. Workbook.Worksheets还有Worksh ...

  8. python对excel某一列去重-「总结篇」Python中所有的Excel操作技巧

    原标题:「总结篇」Python中所有的Excel操作技巧 Python对于Excel的操作是多种多样的,掌握了相关用法就可以随心所欲的操作数据了! 操作xls文件 xlrd(读操作): import ...

  9. VB 6.0中如何访问EXCEL 2007及EXCEL 2010

    问题及分析过程 最近一段时间在使用VB 6.0开发一个OFFICE考试系统,理想的情况是支持WINDOWS XP,WINDOWS 7,WINDOWS 8,Office 2003和Office 2010 ...

最新文章

  1. 学术-数学:哥德巴赫猜想
  2. 32岁封神!苏炳添博士重磅论文:我怎么跑这么快?
  3. 分布式任务队列 Celery — 详解工作流
  4. L4,C16:差1墩,从张数最多的套上去找
  5. C语言Cruskal算法查找最小生成树(附完整源码)
  6. 167. Two Sum II - Input array is sorted (C, C++, Python)
  7. MFC开发-待整理 --VS调试 不会命中断点,源代码与原始版本不同的解决办法
  8. 【Elasticsearch】Bkd-Tree 在 Lucene 中的实现
  9. BZOJ2801/洛谷P3544 [POI2012]BEZ-Minimalist Security(题目性质发掘+图的遍历+解不等式组)...
  10. linux下的C语言开发(线程等待)
  11. 弘辽科技:天猫国际预测2022六大进口消费趋势
  12. 如何备考系统集成项目管理工程师?
  13. React中防止事件冒泡:e.stopPropagation()
  14. CentOS 7中jdk1.8安装
  15. 重装系统教程(适合小白)
  16. TensorFlow搭建CNN实现时间序列预测(风速预测)
  17. 2022华为开发者大赛 首届·厦门开发者创新应用赛在厦门举办
  18. 取代房子,中国又一种资本在崛起
  19. Android程序开发意见反馈的实现
  20. 常用的ITU Speech Codec大全(G.711,G.722.1,G.722.2,G.723.1,G.726,G.728,G.729,G.729.1)

热门文章

  1. 百度主动推送代码 批量改进版
  2. Mac Apple Silicon M1/M2 homebrew miniforge conda pytorch yolov5深度学习环境搭建并简单测试MPS GPU加速
  3. 怎样清理苹果手机内存空间_怎样清理苹果手机内存?清理后流畅好几倍,网友:太好用了!...
  4. While True和Try except
  5. nginx配置代理指向Redis
  6. [教程]OpenSEES超简单易懂的入门第一课
  7. java修改手机锁屏密码,深入理解Android M 锁屏密码存储方式
  8. 解锁火山引擎新一代边缘云,4大场景下的应用与实践
  9. css中怎么给字体描边,教你css实现文字描边
  10. 提升幸福感的100件事