{"id":19301,"date":"2025-09-23T14:42:36","date_gmt":"2025-09-23T18:42:36","guid":{"rendered":"https:\/\/nycphantom.com\/journal\/?p=19301"},"modified":"2025-09-23T14:46:27","modified_gmt":"2025-09-23T18:46:27","slug":"excel-return-row-number-if-value-of-a-cell-matches-a-cell-in-another-column-and-another-condition-is-matched-in-yet-another-column","status":"publish","type":"post","link":"http:\/\/nycphantom.com\/journal\/?p=19301","title":{"rendered":"Excel: Return row number if value of a cell in a column matches a cell in another column and another condition is matched in yet another column"},"content":{"rendered":"\n<p>I needed to do this at work (SPG), and google's AI worked marvelously, as easy as it maybe for advanced Excel Formula experts which I am not.<\/p>\n\n\n\n<p>Ingenious solution by Google:<\/p>\n\n\n\n<p>In Excel, you can return a row number based on multiple criteria using a combination of the&nbsp;<code>INDEX<\/code>&nbsp;and&nbsp;<code>MATCH<\/code>&nbsp;functions. For users with newer versions of Excel (Microsoft 365, 2021), the&nbsp;<code>FILTER<\/code>&nbsp;function is a more straightforward alternative.&nbsp;<\/p>\n\n\n\n<p><strong>Example scenario<\/strong><\/p>\n\n\n\n<p>Imagine you have a table with sales data that includes&nbsp;<code>Product<\/code>,&nbsp;<code>Region<\/code>, and&nbsp;<code>Sales<\/code>. Your goal is to find the row number for the entry where the&nbsp;<code>Product<\/code>&nbsp;is \"Mug\" and the&nbsp;<code>Region<\/code>&nbsp;is \"West\".<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th><\/th><th>A<\/th><th>B<\/th><th>C<\/th><\/tr><tr><td><strong>1<\/strong><\/td><td><strong>Product<\/strong><\/td><td><strong>Region<\/strong><\/td><td><strong>Sales<\/strong><\/td><\/tr><tr><td><strong>2<\/strong><\/td><td>T-Shirt<\/td><td>East<\/td><td>$150<\/td><\/tr><tr><td><strong>3<\/strong><\/td><td>Mug<\/td><td>West<\/td><td>$200<\/td><\/tr><tr><td><strong>4<\/strong><\/td><td>T-Shirt<\/td><td>West<\/td><td>$120<\/td><\/tr><tr><td><strong>5<\/strong><\/td><td>Mug<\/td><td>East<\/td><td>$180<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Formula:<\/strong><br><code>=MATCH(1, (A2:A5=\"Mug\")*(B2:B5=\"West\"), 0)<\/code><\/p>\n\n\n\n<p><strong>How it works:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>(A2:A5=\"Mug\")<\/code>\u00a0<strong>creates an array<\/strong> of\u00a0<code>TRUE<\/code>\u00a0or\u00a0<code>FALSE<\/code>\u00a0values. In our example, it becomes\u00a0<code><strong>{FALSE;TRUE;FALSE;FALSE}<\/strong><\/code>.<\/li>\n\n\n\n<li><code>(B2:B5=\"West\")<\/code>\u00a0does the <strong>same <\/strong>for the second condition, creating\u00a0<code><strong>{FALSE;TRUE;TRUE;FALSE}<\/strong><\/code>.<\/li>\n\n\n\n<li>The <strong>multiplication operator\u00a0<code>*<\/code>\u00a0acts as an\u00a0<code>AND<\/code>\u00a0operator<\/strong>. Excel treats\u00a0<code>TRUE<\/code>\u00a0as\u00a0<code>1<\/code>\u00a0and\u00a0<code>FALSE<\/code>\u00a0as\u00a0<code>0<\/code>, so the formula multiplies the two arrays element by element. Only the row where both conditions are\u00a0<code>TRUE<\/code>\u00a0will result in a\u00a0<code>1<\/code>. The <strong>resulting array is\u00a0<code>{0;1;0;0}<\/code><\/strong>.<\/li>\n\n\n\n<li><code>MATCH(1, {0;1;0;0}, 0)<\/code>\u00a0then searches for the value\u00a0<code>1<\/code>\u00a0in this new array and returns its relative position. In this case, it's the <strong>second <\/strong>position.\u00a0<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I needed to do this at work (SPG), and google's AI worked marvelously, as easy as it maybe for advanced Excel Formula experts which I am not. Ingenious solution by Google: In Excel, you can return a row number based &hellip; <a href=\"http:\/\/nycphantom.com\/journal\/?p=19301\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[],"class_list":["post-19301","post","type-post","status-publish","format-standard","hentry","category-computer-science"],"_links":{"self":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/19301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19301"}],"version-history":[{"count":3,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/19301\/revisions"}],"predecessor-version":[{"id":19306,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=\/wp\/v2\/posts\/19301\/revisions\/19306"}],"wp:attachment":[{"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19301"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nycphantom.com\/journal\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}