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.pswp.cn/news/390612.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390612.shtml
英文地址,請注明出處:http://en.pswp.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 …