vlookup match_INDEX-MATCH — VLOOKUP功能的升级

vlookup match

电子表格/索引匹配 (SPREADSHEETS / INDEX-MATCH)

In a previous article, we discussed about how and when to use VLOOKUP functions and what are the issues that we might face while using them. This article, on the other hand, will take you to a journey to understand an upgraded version of VLOOKUP. This upgrade is a combination of two functions in spreadsheets — INDEX and MATCH. Let us try and understand the working of INDEX-MATCH through the following example.

在上一篇文章中 ,我们讨论了如何以及何时使用VLOOKUP函数,以及在使用它们时可能遇到的问题。 另一方面,本文将带您了解VLOOKUP升级版本 。 此升级是电子表格中两个功能的组合INDEX和MATCH 。 让我们尝试通过以下示例来理解INDEX-MATCH的工作。

了解数据 (Understanding the Data)

As always, let us take an example from our favorite data source — Kaggle. The following screenshot is a small subset of the Netflix data which consists of TV shows and movies available on Netflix as of 2019.

与往常一样,让我们​​以我们最喜欢的数据源Kaggle为例。 以下屏幕截图是Netflix数据的一小部分,其中包括截至2019年Netflix上可用的电视节目和电影。

Image for post
Netflix Data for INDEX-MATCH demonstration
用于INDEX-MATCH演示的Netflix数据

This dataset consists of different shows and movies along with their unique show_id, country we are considering, date when the show was added and the year when the entity was released. It also contains rating of the show/movie, duration and title of the content piece.

该数据集包含不同的节目和电影,以及它们唯一的show_id ,我们正在考虑的country ,添加节目的date和发布实体的year 。 它还包含内容的放映/电影ratingdurationtitle

Consider now that we want to create a search method where the user can select a title and we display information to the user regarding that title. This search method would look something like this:

现在考虑,我们想创建一种搜索方法,用户可以在其中选择title然后向用户显示有关该标题的信息。 此搜索方法如下所示:

Image for post
Example of how the search method will look like
搜索方法外观示例

The user can input any title in the above example and we will try and find the type and rating of the title mentioned from the database. One of the simpler solutions to this is through VLOOKUP. We can easily find the rating of the title through it. Although, we would need to change the structure of the table to get the type of the title since VLOOKUP can only look to the right of the search value. Let’s see how can INDEX and MATCH formulas help us in solving this problem.

用户可以在上面的示例中输入任何title ,我们将尝试从数据库中查找提到的标题的typerating 。 一种更简单的解决方案是通过VLOOKUP。 我们可以通过它轻松找到标题的等级。 虽然,我们将需要更改的结构以获取标题的类型,因为VLOOKUP 只能在搜索值的右侧查找。 让我们看看INDEX和MATCH公式如何帮助我们解决此问题。

什么是索引? (What is INDEX?)

INDEX formula in spreadsheets look something like this:

电子表格中的INDEX公式如下所示:

Image for post
INDEX formula in Google Spreadsheets
Google Spreadsheets中的INDEX公式

INDEX helps us in finding the content of the cell. It takes 3 inputs.

INDEX帮助我们找到单元格的内容。 它需要3个输入。

  • Row: The number of rows from the beginning of the reference table where the value lies. This is an optional value. If no value is supplied, it will take the first row as the value.

    :从值所在的引用表的开头开始的行数。 这是一个可选值。 如果未提供任何值,则它将第一行作为值。

  • Column: The number of columns from the beginning of the reference table where the value lies. This is an optional value. If no value is supplied, it will take the first column as the value.

    :从值所在的参考表开始的列数。 这是一个可选值。 如果未提供任何值,则它将第一列作为值。

To find the type of the title ‘Carrie Pilby’ in our table, we apply the following formula:

要在我们的表格中找到标题“ Carrie Pilby”的类型,我们使用以下公式:

=INDEX(A1:H23,12,2)

We select the complete table as reference, we find that this movie title is in the 12th row and we know that the type of the title is stored in 2nd column of the reference table. This will give the result as ‘Movie’ which is absolutely correct!

我们选择完整的表作为参考 ,我们发现该电影标题位于第12行,并且知道标题的类型存储在参考表的第二列中。 这将给出绝对正确的“电影”结果!

But did you notice any problems with this? We actually had to count the row number and the column number to get 12 and 2 as the parameters in the formula. This isn’t easy, is it? Let’s find out if there is any other way in the world which can help us in easing this process.

但是您注意到这个有什么问题吗? 实际上,我们必须对行号和列号进行计数,以获得12和2作为公式中的参数。 这不容易,是吗? 让我们找出世界上是否还有其他方法可以帮助我们简化这一过程。

什么是MATCH? (What is MATCH?)

MATCH formula in spreadsheets look something like this:

电子表格中的MATCH公式如下所示:

Image for post
MATCH formula in Google Spreadsheets
Google Spreadsheets中的MATCH公式

MATCH helps us in finding the relative position of the content in our table. It takes 3 inputs.

MATCH帮助我们找到表中内容的相对位置。 它需要3个输入。

  • Search Key: The value that we want to find.

    搜索键 :我们要查找的值。

  • Range: The row/column in which the value is situated. Note that range can only take a row or a column, but not both.

    范围 :值所在的行/列。 请注意,范围只能包含一行或一列,但不能同时包含两者。

  • Search Type: For all practical purpose, we set this value as zero. This indicates that we are finding the exact value. This is an optional term which takes the value as 1 by default.

    搜索类型 :出于所有实际目的, 我们将此值设置为零 。 这表明我们正在寻找确切的值。 这是一个可选术语,默认情况下将值设为1。

MATCH essentially gives us the row number or the column number of where the search term lies. Isn’t this the missing part of the INDEX puzzle we encountered earlier? We needed an easier way to find the row and column number of the search item, rather than counting it manually. And MATCH gives you exactly that!

MATCH本质上为我们提供了搜索词所在的行号或列号。 这不是我们之前遇到的INDEX难题缺失部分吗? 我们需要一种更简单的方法来查找搜索项的行号和列号,而不是手动对其进行计数。 而MATCH正是为您提供!

神圣的INDEX-MATCH婚姻 (The holy INDEX-MATCH matrimony)

The above explanation now allows us to join the INDEX and MATCH formulas together and get the information we require with the minimum amount of hassle. Here is how a general INDEX-MATCH formula would look like:

上面的解释现在使我们可以将INDEX和MATCH公式结合在一起,并以最少的麻烦获得所需的信息。 通用INDEX-MATCH公式如下所示:

=INDEX(reference, MATCH(search_key, row, 0), MATCH(search_key, column, 0))

In the above formula, we provide a reference table to the INDEX, which is basically the data table where all the information is. Next, the first MATCH formula provides the row index of the search term and the second MATCH provides the column index of the search term. Finally, the combination of these two will provide the row and column index to the INDEX formula and we’ll get our desired result! Let’s try it out in our Netflix example.

在上面的公式中,我们提供了INDEX参考表 ,它基本上是所有信息所在的数据表。 接下来,第一个MATCH公式提供搜索项行索引, 第二个 MATCH公式提供搜索项列索引 。 最后,这两者的结合将为INDEX公式提供行索引和列索引,我们将获得理想的结果! 让我们在Netflix示例中尝试一下。

Image for post
INDEX-MATCH for finding content type
INDEX-MATCH用于查找内容类型

The above formula selects the entire table in first parameter of INDEX. Then it searches for the movie title mentioned in K1 through MATCH formula in the entire row of content titles, which is C1:C23. This will return whatever row number the title ‘Carrie Pilby’ is in. In the second MATCH, it searches for J2, which is the parameter that we want to find, in this case Type. This will return whatever column the column name ‘Type’ is in. And together it will provide the correct result i.e. Movie.

上面的公式在INDEX的第一个参数中选择整个表。 然后,它通过MATCH公式在整个内容标题行(即C1:C23)中搜索K1中提到的电影标题。 这将返回标题为“ Carrie Pilby”所在的行号。在第二个MATCH中,它将搜索J2,这是我们要查找的参数,在本例中为Type。 这将返回列名“ Type”所在的任何列。并且一起提供正确的结果,即Movie。

Similarly, here is the formula for how to match rating in the table for the given content title.

同样,这是有关如何匹配表中给定内容标题的评级的公式。

Image for post
INDEX-MATCH for finding content rating
INDEX-MATCH用于查找内容分级

与VLOOKUP比较 (Comparing with VLOOKUP)

Often there will be comparisons on which formula to use to find the values of a given content. Although VLOOKUP is simpler to understand and provides an easy application, the INDEX-MATCH combination is a powerful match which provides the following advantages:

通常会比较使用哪个公式来查找给定内容的值。 尽管VLOOKUP易于理解并且易于使用,但INDEX-MATCH组合是功能强大的匹配项,具有以下优点:

  1. You can use INDEX-MATCH to find a value against multiple criteria. In the above examples, we found Type and Rating with content name criteria and parameter criteria. This wouldn’t have been easy to achieve in VLOOKUP.

    您可以使用INDEX-MATCH 根据多个条件查找值 。 在以上示例中,我们找到了带有内容名称标准和参数标准的TypeRating 。 这在VLOOKUP中并非容易实现。

  2. VLOOKUP finds a match on the left and returns any value to the right of the search item. On the other hand, INDEX-MATCH can look both ways. In the above example, type was on the left of title and rating on the right, still it managed to find both the results correctly.

    VLOOKUP在左侧找到一个匹配项,并在搜索项的右侧返回任何值。 另一方面, INDEX-MATCH可以双向查看 。 在上面的示例中,类型位于标题的左侧,评级位于右侧,但仍设法正确找到了两个结果。

Understanding INDEX-MATCH adds an extremely versatile tool in your spreadsheet armory. INDEX-MATCH along with the knowledge of Pivot Tables can really help you to improve your analytical skills. Let me know in comments if this was a helpful piece of content!

了解INDEX-MATCH可以在电子表格库中添加一个极其通用的工具。 INDEX-MATCH以及数据透视表的知识可以真正帮助您提高分析技能。 在评论中让我知道这是否是有用的内容!

翻译自: https://towardsdatascience.com/index-match-an-upgrade-on-vlookup-functions-320e43253d15

vlookup match

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/390612.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

java基础-BigDecimal类常用方法介绍

java基础-BigDecimal类常用方法介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任。 一.BigDecimal类概述 我们知道浮点数的计算结果是未知的。原因是计算机二进制中,表示浮点数不精确造成的。这个时候…

节点对象转节点_节点流程对象说明

节点对象转节点The process object in Node.js is a global object that can be accessed inside any module without requiring it. There are very few global objects or properties provided in Node.js and process is one of them. It is an essential component in the …

PAT——1018. 锤子剪刀布

大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示: 现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。 输入格式: 输入第1行给出正整数N&am…

leetcode 1239. 串联字符串的最大长度

题目 二进制手表顶部有 4 个 LED 代表 小时(0-11),底部的 6 个 LED 代表 分钟(0-59)。每个 LED 代表一个 0 或 1,最低位在右侧。 例如,下面的二进制手表读取 “3:25” 。 (图源&am…

flask redis_在Flask应用程序中将Redis队列用于异步任务

flask redisBy: Content by Edward Krueger and Josh Farmer, and Douglas Franklin.作者: 爱德华克鲁格 ( Edward Krueger) 和 乔什法默 ( Josh Farmer )以及 道格拉斯富兰克林 ( Douglas Franklin)的内容 。 When building an application that performs time-co…

CentOS7下分布式文件系统FastDFS的安装 配置 (单节点)

背景 FastDFS是一个开源的轻量级分布式文件系统,为互联网量身定制,充分考虑了冗余备份、负载均衡、线性扩容等机制,并注重高可用、高性能等指标,解决了大容量存储和负载均衡的问题,特别适合以文件为载体的在线服务&…

如何修复会话固定漏洞_PHP安全漏洞:会话劫持,跨站点脚本,SQL注入以及如何修复它们...

如何修复会话固定漏洞PHP中的安全性 (Security in PHP) When writing PHP code it is very important to keep the following security vulnerabilities in mind to avoid writing insecure code.在编写PHP代码时,记住以下安全漏洞非常重要,以避免编写不…

剑指 Offer 38. 字符串的排列

题目 输入一个字符串,打印出该字符串中字符的所有排列。 你可以以任意顺序返回这个字符串数组,但里面不能有重复元素。 示例: 输入:s “abc” 输出:[“abc”,“acb”,“bac”,“bca”,“cab”,“cba”] 限制: 1…

前馈神经网络中的前馈_前馈神经网络在基于趋势的交易中的有效性(1)

前馈神经网络中的前馈This is a preliminary showcase of a collaborative research by Seouk Jun Kim (Daniel) and Sunmin Lee. You can find our contacts at the bottom of the article.这是 Seouk Jun Kim(Daniel) 和 Sunmin Lee 进行合作研究的初步展示 。 您可以在文章底…

解释什么是快速排序算法?_解释排序算法

解释什么是快速排序算法?Sorting algorithms are a set of instructions that take an array or list as an input and arrange the items into a particular order.排序算法是一组指令,这些指令采用数组或列表作为输入并将项目按特定顺序排列。 Sorts are most c…

SpringBoot自动化配置的注解开关原理

我们以一个最简单的例子来完成这个需求:定义一个注解EnableContentService,使用了这个注解的程序会自动注入ContentService这个bean。 Retention(RetentionPolicy.RUNTIME) Target(ElementType.TYPE) Import(ContentConfiguration.class) public interfa…

hadoop将消亡_数据科学家:适应还是消亡!

hadoop将消亡Harvard Business Review marked the boom of Data Scientists in their famous 2012 article “Data Scientist: Sexiest Job”, followed by untenable demand in the past decade. [3]《哈佛商业评论 》在2012年著名的文章“数据科学家:最性感的工作…

剑指 Offer 15. 二进制中1的个数 and leetcode 1905. 统计子岛屿

题目 请实现一个函数,输入一个整数(以二进制串形式),输出该数二进制表示中 1 的个数。例如,把 9 表示成二进制是 1001,有 2 位是 1。因此,如果输入 9,则该函数输出 2。 示例 1&…

[转]kafka介绍

转自 https://www.cnblogs.com/hei12138/p/7805475.html kafka介绍1.1. 主要功能 根据官网的介绍,ApacheKafka是一个分布式流媒体平台,它主要有3种功能: 1:It lets you publish and subscribe to streams of records.发布和订阅消…

如何开始android开发_如何开始进行Android开发

如何开始android开发Android开发简介 (An intro to Android Development) Android apps can be a great, fun way to get into the world of programming. Officially programmers can use Java, Kotlin, or C to develop for Android. Though there may be API restrictions, …

httpd2.2的配置文件常见设置

目录 1、启动报错:提示没有名字fqdn2、显示服务器版本信息3、修改监听的IP和Port3、持久连接4 、MPM( Multi-Processing Module )多路处理模块5 、DSO:Dynamic Shared Object6 、定义Main server (主站点) …

leetcode 149. 直线上最多的点数

题目 给你一个数组 points ,其中 points[i] [xi, yi] 表示 X-Y 平面上的一个点。求最多有多少个点在同一条直线上。 示例 1: 输入:points [[1,1],[2,2],[3,3]] 输出:3 示例 2: 输入:points [[1,1],[3,…

solidity开发以太坊代币智能合约

智能合约开发是以太坊编程的核心之一,而代币是区块链应用的关键环节,下面我们来用solidity语言开发一个代币合约的实例,希望对大家有帮助。 以太坊的应用被称为去中心化应用(DApp),DApp的开发主要包括两大部…

2019大数据课程_根据数据,2019年最佳免费在线课程

2019大数据课程As we do each year, Class Central has tallied the best courses of the previous year, based on thousands of learner reviews. (Here are the rankings from 2015, 2016, 2017, and 2018.) 与我们每年一样,根据数千名学习者的评论, …

2017-12-07 socket 读取问题

1.用socke阻塞方式读取服务端发送的数据时会出现读取一直阻塞的情况,如果设置了超时时间会在超时时间后读取到数据: 原因:在不确定服务器会不会发送 socket发送的数据不会返回null 或者-1 所以用常规的判断方法是不行的。 解决办法有两个:1 …