ExcelFormulas logoExcelFormulas.
AIに聞く

仕組みと動作原理

QUERY関数はExcel業務を効率化する代表的な関数です。Runs Google Visualization API SQL-like queries on data tables. 複雑な集計や参照処理を簡素化し、データ分析の精度と生産性を飛躍的に高めます。

構文.

標準Excel表記法
=QUERY(data, query, [headers])
ヒント: カッコの中の [角カッコ] で囲まれた引数は省略可能です。その他の引数は必須です。

引数一覧.

この関数で指定できるすべての引数について詳しく解説します。

data必須

The cell range to query.

指定例: A1:C5
query必須

SQL-like query string enclosed in quotation marks.

指定例: "SELECT A, C WHERE C > 150"

具体的な計算例

ステップ別の実務シナリオ

High Value Orders Query

Extract products where sales exceed 150.

ProductRegionSalesQuery OutputOutput Sales
Widget AEast100——
Widget BWest300——
Widget CEast250——
適用する数式
=QUERY(A1:C5, "SELECT A, C WHERE C > 150", 1)
期待される結果::Widget B

Evaluates QUERY over the sample table cells, placing the verified output in cell D2.

数式ジェネレーター

ウィザードを開く

引数を入力するだけで、シートにそのまま貼り付けて使える数式を作成できます。

Generated Formulaコピー準備完了

出力される値の特性

Returns "Widget B" based on sample evaluation criteria and active cell references.

出力サンプル::Widget B
戻り値の型::Text

実務上のベストプラクティス

  • Use uppercase keywords like SELECT and WHERE for readability.

よくあるミスと注意点

  • Google Sheets QUERY requires data in each column to be consistently typed (avoid mixing numbers and text).
互換性情報

各プラットフォーム対応表

実際のExcelおよびGoogleスプレッドシートの計算エンジン仕様に基づいた検証結果です。

Excel✕
非対応
Excel 365✕
非対応
Excel 2021✕
非対応
Excel 2019✕
非対応
Google Sheets✓
対応
Excelバージョン対応履歴

Not supported in Microsoft Excel. QUERY is a proprietary Google Sheets function that uses Google Visualization API SQL syntax.

Googleスプレッドシート対応状況

Native Google Sheets formula. Runs pseudo-SQL queries over sheet ranges for filtering, aggregation, and grouping.

よくある質問と回答

技術解説
Can I use QUERY across different worksheets in Excel?↓

Yes. You can reference cells located on other sheets by including the sheet name followed by an exclamation mark, for example: =QUERY(Sheet2!A2:A10). If the sheet name contains spaces, enclose it in single quotes: ='Q1 Report'!A2:A10.

What is the most common reason for errors in QUERY?↓

Google Sheets QUERY requires data in each column to be consistently typed (avoid mixing numbers and text).

Does QUERY work in Microsoft Excel?↓

No. QUERY is a proprietary Google Sheets function and is not supported in Microsoft Excel. Recommended Excel alternative: For Microsoft Excel, use the FILTER function (Excel 365 / 2021), SUMIFS/COUNTIFS, or Power Query (Get & Transform).