{"id":8500,"date":"2021-11-29T16:17:17","date_gmt":"2021-11-29T16:17:17","guid":{"rendered":"https:\/\/officetuts.net\/excel\/?p=8500"},"modified":"2024-03-29T14:06:07","modified_gmt":"2024-03-29T14:06:07","slug":"get-value-from-an-array","status":"publish","type":"post","link":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/","title":{"rendered":"Get Value from an Array in Excel"},"content":{"rendered":"\n
Get-Value-from-the-Array<\/a>Download File<\/a><\/div>\n\n\n\n

If you are dealing with Excel, you will certainly stumble upon arrays at some point in time. Excel arrays are structures that can hold a collection of values.<\/p>\n\n\n\n

In the example below, we will show how to get the value that we want from 2-dimensional arrays.<\/p>\n\n\n\n

Get Value from 2D Array<\/h2>\n\n\n\n

For our example, we are going to use a table of NBA players and their statistics for several nights, including points, rebounds, and turnovers:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n\n\n\n

Now, if we want to find out the location of any value of our values in terms of its rows and columns, we can use the following formulas:<\/p>\n\n\n\n

=SUMPRODUCT((data=FORMULA(data))*ROW(data))-ROW(array)+1<\/code><\/pre>\n\n\n\n
=SUMPRODUCT((data=FORMULA(data))*COLUMN(data))-COLUMN(data)+1<\/code><\/pre>\n\n\n\n

Array in this case represents the cells from which we want to derive our data.<\/p>\n\n\n\n

Our goal is to find the column and row number for any given value. What the formula above does, is that it uses any formula that we want (MIN, MAX<\/strong>, or similar), and compares our data to this value. Then we get an array of TRUE<\/strong> and FALSE<\/strong> results. When we get these results, we multiply them by the result of ROW (or COLUMN) <\/strong>and an array of row numbers. At the and, we add the number 1<\/strong> to get an index that is relative to our named array.<\/p>\n\n\n\n

We will use this formula to try to find the MAX<\/strong> value for the range D2:G9<\/strong>.<\/p>\n\n\n\n

To find out the minimum value of this range, we will input the following formula in cell J2<\/strong>:<\/p>\n\n\n\n

=MAX(D2:G9)<\/code><\/pre>\n\n\n\n

We can see that that value is 35<\/strong>:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n\n\n\n

Now we want to find the location of this value (to which column it belongs and to which row).<\/p>\n\n\n\n

First, we will find the row value by using the following formula:<\/p>\n\n\n\n

=SUMPRODUCT((D2:G9=MAX(D2:G9))*ROW(D2:G9))-ROW(D2:G9)+1<\/code><\/pre>\n\n\n\n

We are using this formula to find the max value of our range, and we produce multiple checks for true and false. Once we input this formula, we will get the following result:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n\n\n\n

You will notice that we will get the number 8<\/strong> as our result, which is correct. You will also notice that we have a bunch of other numbers created beneath, all the way up to number 1<\/strong>.<\/p>\n\n\n\n

This is called spill behavior<\/strong>. It is automatic and native, and in Office 365<\/strong> any formula can spill results. Spilling cannot be disabled with some global settings.<\/p>\n\n\n\n

To ensure that it does not appear in our example, we will input the \u201c@\u201d<\/strong> sign in our formula, right behind the \u201c=\u201d <\/strong>sign. We will then click ENTER<\/strong> and get the following results:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n\n\n\n

Now, to get the column number, we will use the following formula:<\/p>\n\n\n\n

=SUMPRODUCT((D2:G9=MAX(D2:G9))*COLUMN(D2:G9))-COLUMN(D2:G9)+1<\/code><\/pre>\n\n\n\n

We will also add a \u201c@\u201d<\/strong> sign in front of our formula, and will have the following results in our table:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n\n\n\n

We now have the exact location of our desired cell (max value in our range) that represents a cell in the eighth row and first column, i.e. cell D9<\/strong>.<\/p>\n\n\n\n

Get Corresponding Column for Value in Array<\/h2>\n\n\n\n

If we want to find out to which column in our array our value belongs, we can use the following formula:<\/p>\n\n\n\n

=INDEX(array,1,SMALL(IF(NOT(ISERROR(SEARCH(desired cell, array))),COLUMN(column that are included),99^99),1))<\/code><\/pre>\n\n\n\n

We know that our array will be our whole table. We want to find in which column the word \u201eLeBron James\u201c<\/strong> is located, and we will put his name in cell L2<\/strong>. Our formula will look like this:<\/p>\n\n\n\n

=INDEX($A$1:$G$9,1,SMALL(IF(NOT(ISERROR(SEARCH(L2,$A$1:$G$9))),COLUMN($A:$G),99^99),1))<\/code><\/pre>\n\n\n\n

When we put this formula into the cell M2<\/strong>, it will look like this:<\/p>\n\n\n\n

\"Table,<\/figure>\n\n\n\n

And we will have our desired result:<\/p>\n\n\n\n

\"Table,<\/figure>\n\n\n\n

To simply explain it, the above formula does the following:<\/p>\n\n\n\n

    \n
  • It uses the SEARCH function<\/strong> to find if any entries in our range are equal to cell L2<\/strong>. This formula produces an array of values.<\/li>\n\n\n\n
  • It then uses IF and NOT<\/strong> to find the column number if we find the match. Otherwise, it returns a very high number (99^99<\/strong>).<\/li>\n\n\n\n
  • Then we use the SMALL function<\/strong> to retrieve the lowest column number where we have a match.<\/li>\n\n\n\n
  • Now when we have the column number we will use the INDEX function<\/strong> in the end to retrieve the value.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"

    If you are dealing with Excel, you will certainly stumble upon arrays at some point in time. Excel arrays are structures that can…<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[170,190],"yoast_head":"\nGet Value from an Array in Excel<\/title>\n<meta name=\"description\" content=\"Learn how to extract values from 2D arrays in Excel with our easy-to-follow tutorial. Download the sample file and try it yourself today!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Value from an Array in Excel\" \/>\n<meta property=\"og:description\" content=\"Learn how to extract values from 2D arrays in Excel with our easy-to-follow tutorial. Download the sample file and try it yourself today!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-29T16:17:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-29T14:06:07+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png\" \/>\n<meta name=\"author\" content=\"Harun Spahic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Harun Spahic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/\"},\"author\":{\"name\":\"Harun Spahic\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2\"},\"headline\":\"Get Value from an Array in Excel\",\"datePublished\":\"2021-11-29T16:17:17+00:00\",\"dateModified\":\"2024-03-29T14:06:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/\"},\"wordCount\":659,\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png\",\"keywords\":[\"file\",\"pinterest\"],\"articleSection\":[\"formulas\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/\",\"url\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/\",\"name\":\"Get Value from an Array in Excel\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png\",\"datePublished\":\"2021-11-29T16:17:17+00:00\",\"dateModified\":\"2024-03-29T14:06:07+00:00\",\"description\":\"Learn how to extract values from 2D arrays in Excel with our easy-to-follow tutorial. Download the sample file and try it yourself today!\",\"breadcrumb\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage\",\"url\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png\",\"contentUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/officetuts.net\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get Value from an Array in Excel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/officetuts.net\/excel\/#website\",\"url\":\"https:\/\/officetuts.net\/excel\/\",\"name\":\"\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/officetuts.net\/excel\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\",\"name\":\"Tomasz Decker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"caption\":\"Tomasz Decker\"},\"logo\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\"},\"description\":\"Spreadsheet and Python enthusiast.\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2\",\"name\":\"Harun Spahic\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g\",\"caption\":\"Harun Spahic\"},\"sameAs\":[\"http:\/\/human.bsru.ac.th\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get Value from an Array in Excel","description":"Learn how to extract values from 2D arrays in Excel with our easy-to-follow tutorial. Download the sample file and try it yourself today!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/","og_locale":"en_US","og_type":"article","og_title":"Get Value from an Array in Excel","og_description":"Learn how to extract values from 2D arrays in Excel with our easy-to-follow tutorial. Download the sample file and try it yourself today!","og_url":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/","article_published_time":"2021-11-29T16:17:17+00:00","article_modified_time":"2024-03-29T14:06:07+00:00","og_image":[{"url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png"}],"author":"Harun Spahic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Harun Spahic","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#article","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/"},"author":{"name":"Harun Spahic","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2"},"headline":"Get Value from an Array in Excel","datePublished":"2021-11-29T16:17:17+00:00","dateModified":"2024-03-29T14:06:07+00:00","mainEntityOfPage":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/"},"wordCount":659,"publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"image":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png","keywords":["file","pinterest"],"articleSection":["formulas"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/","url":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/","name":"Get Value from an Array in Excel","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage"},"image":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png","datePublished":"2021-11-29T16:17:17+00:00","dateModified":"2024-03-29T14:06:07+00:00","description":"Learn how to extract values from 2D arrays in Excel with our easy-to-follow tutorial. Download the sample file and try it yourself today!","breadcrumb":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#primaryimage","url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png","contentUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2021\/11\/table-description-automatically-generated-20.png"},{"@type":"BreadcrumbList","@id":"https:\/\/officetuts.net\/excel\/formulas\/get-value-from-an-array\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/officetuts.net\/excel\/"},{"@type":"ListItem","position":2,"name":"Get Value from an Array in Excel"}]},{"@type":"WebSite","@id":"https:\/\/officetuts.net\/excel\/#website","url":"https:\/\/officetuts.net\/excel\/","name":"","description":"","publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/officetuts.net\/excel\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42","name":"Tomasz Decker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","caption":"Tomasz Decker"},"logo":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/"},"description":"Spreadsheet and Python enthusiast."},{"@type":"Person","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2","name":"Harun Spahic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g","caption":"Harun Spahic"},"sameAs":["http:\/\/human.bsru.ac.th\/"]}]}},"_links":{"self":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/8500"}],"collection":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/comments?post=8500"}],"version-history":[{"count":5,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/8500\/revisions"}],"predecessor-version":[{"id":17391,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/8500\/revisions\/17391"}],"wp:attachment":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/media?parent=8500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/categories?post=8500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/tags?post=8500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}