PR
【本当に使えるExcel】INDEXの使い方とコツ!MATCH関数と組み合わせて検索

私は教員を辞めて、現在ではパソコンを使って仕事をしています。
教員時代にExcelを一通り学んだのですが、【本当に使えるExcel】では、実際にExcelファイルを作る際に使える関数などを紹介していきます。

具体的な使い方や使う際のコツなんかも紹介します!
この記事では検索&抜き出しでよく使うVLOOKUPの代わりに使える、INDEXの使い方とコツを説明していきます。



Excelを作る際に重要な考え方の基本も説明しています!
これを読めばExcelファイルを作る効率がさらに上がりますよ!
(note記事です)


INDEXとは
INDEX単体は、「この表の何行・何列のセルを表示する」という関数になります。





INDEXの構文を押さえておきましょう!
INDEX
=INDEX(この表,何行,何列)



…で?
という感じですよね。
INDEXはこれだけでは、「この表の中で指定した行・列のセルを表示させる」というだけですが、これにMATCH関数を組み合わせることでVLOOKUPと同じような検索&抜き出しの機能を持たせることができます!
INDEX+MATCHで検索&抜き出し
MATCHとは?
MATCHは次の構文で、その値が何番目にあるか?を返す関数です。
MATCH
=MATCH(その値,検索範囲,検索方法)
※ 最後の検索方法は省略可ですが、省略するとTRUEになります。これが結構検索ミスを起こしやすいので、明示的に「FALSE」か「0」を入れておいた方がいいです。
何番目か?を返すので、例えば次のようなMATCHの使い方をした場合「3」となります。





それでは、INDEXとMATCHを使って、検索キーと一致する行を抜き出すVLOOKUPのような機能を作っていきましょう!
INDEXとMATCHを組み合わせて使う
もったいぶっても仕方ないので、使い方を説明していきましょう!
INDEX+MATCHでVLOOKUPのような機能を作る
=INDEX(この表,MATCH(その値,検索範囲,検索方法),何列)
これだけです!
ポイントはINDEXの「何行?」のところに先ほどのMATCHを使っている点です。
MATCHは「その値が検索範囲の何番目?」を返すので、その値と検索したい範囲を指定することで何番目?=何行目?かを検索してセルの中身を返すことができます。


INDEXとMATCHをわざわざ組み合わせるメリットは?
わざわざINDEXとMATCHを組み合わせるメリット、それは、
VLOOKUPの最大のデメリットである「左端しか検索できない」という点が解消できる
ところです。
=INDEX(この表,MATCH(その値,検索範囲,検索方法),何列)
の検索範囲のところを好きな列で指定すれば、左端だけでなく、どの列の検索も可能です。



これでVLOOKUPの左端検索地獄から解放されます!(VLOOKUPはVLOOKUPで使えるんですけどね…)


まとめ
VLOOKUPの代わりに使えるINDEX関数の使い方とコツでした。
INDEXとMATCHを組み合わせるので、最初はちょっと慣れないかもしれませんが、「INDEXの行をMATCHで検索する」と覚えておきましょう。



慣れれば検索キーを柔軟に指定できるので便利ですよ!



