メインコンテンツへスキップ

ピボットテーブルで一意の値をカウントする方法は?

デフォルトでは、重複する値を含むデータの範囲に基づいてピボットテーブルを作成すると、すべてのレコードもカウントされますが、場合によっては、XNUMXつの列に基づいて一意の値をカウントして適切な値を取得する必要があります。スクリーンショットの結果。 この記事では、ピボットテーブルの一意の値をカウントする方法について説明します。

ヘルパー列を使用してピボットテーブルの一意の値をカウントします

Excel2013以降のバージョンの値フィールド設定を使用してピボットテーブルの一意の値をカウントします


ヘルパー列を使用してピボットテーブルの一意の値をカウントします

Excelでは、一意の値を識別するためのヘルパー列を作成する必要があります。次の手順で実行してください。

1。 データ以外の新しい列に、この式を入力してください =IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))>1,0,1) セルC2に移動し、塗りつぶしハンドルをこの数式を適用する範囲セルにドラッグすると、次のスクリーンショットに示すように一意の値が識別されます。

2。 これで、ピボットテーブルを作成できます。 ヘルパー列を含むデータ範囲を選択し、をクリックします インセット > ピボットテーブル > ピボットテーブル、スクリーンショットを参照してください:

3。 その後、 ピボットテーブルを作成する ダイアログで、ピボットテーブルを配置する新しいワークシートまたは既存のワークシートを選択します。スクリーンショットを参照してください。

4に設定します。 OK をクリックします。 OK、次にドラッグします CLASS 〜へのフィールド 行ラベル ボックスをクリックし、ドラッグします ヘルパー の項目に表示されます。 〜へのフィールド 価値観 ボックスをクリックすると、一意の値をカウントするだけの次のピボットテーブルが表示されます。


Excel2013以降のバージョンの値フィールド設定を使用してピボットテーブルの一意の値をカウントします

Excel 2013以降のバージョンでは、新しい 個別のカウント ピボットテーブルに関数が追加されました。この機能を適用して、このタスクをすばやく簡単に解決できます。

1。 データ範囲を選択して、 インセット > ピボットテーブル、で ピボットテーブルを作成する ダイアログボックスで、ピボットテーブルを配置する新しいワークシートまたは既存のワークシートを選択し、チェックします。 このデータをデータモデルに追加します チェックボックス、スクリーンショットを参照してください:

2。 その後、 ピボットテーブルフィールド ペインで、 CLASS フィールドを ボックスをクリックし、ドラッグします 名前 フィールドを 価値観 ボックス、スクリーンショットを参照してください:

3. そして、 名前の数 ドロップダウンリスト、選択 値フィールド設定、スクリーンショットを参照してください:

4。 の中に 値フィールド設定 ダイアログ、クリック 値を要約する タブをクリックし、スクロールしてクリックします 個別のカウント オプション、スクリーンショットを参照してください:

5。 そして、 OK、一意の値のみをカウントするピボットテーブルを取得します。

  • Note:チェックした場合 このデータをデータモデルに追加します 内のオプション ピボットテーブルを作成する ダイアログボックス、 計算フィールド 機能が無効になります。

より相対的なピボットテーブルの記事:

  • 同じフィルターを複数のピボットテーブルに適用する
  • 同じデータソースに基づいて複数のピボットテーブルを作成し、2010つのピボットテーブルをフィルタリングし、他のピボットテーブルも同じ方法でフィルタリングする場合があります。つまり、複数のピボットテーブルフィルターを一度に変更する必要があります。 Excel。 この記事では、ExcelXNUMX以降のバージョンでの新機能スライサーの使用法について説明します。
  • Excelでピボットテーブルの範囲を更新する
  • Excelでは、データ範囲内の行または列を削除または追加しても、相対ピボットテーブルは同時に更新されません。 このチュートリアルでは、データテーブルの行または列が変更されたときにピボットテーブルを更新する方法を説明します。
  • Excelのピボットテーブルで空白行を非表示にする
  • ご存知のように、ピボットテーブルはExcelでデータを分析するのに便利ですが、下のスクリーンショットに示すように、行に空白のコンテンツが表示される場合があります。 次に、Excelのピボットテーブルでこれらの空白行を非表示にする方法を説明します。

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (28)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thanks ! Saved me a lot of hours, me and my friend !
This comment was minimized by the moderator on the site
My Excel dont have check box " Add this data to the Data Model"
So, What can i do?
This comment was minimized by the moderator on the site
It supports only . xlsx
I have faced with the same problem. Nodody mention this. Everyone talk about MS Excel, and nobody about file)))
This comment was minimized by the moderator on the site
Hello, Jay,
Which Excel version do you use? This option is only added for Excl 2013 and later versions. If you do not find this option, please apply the first method in this article.
https://www.extendoffice.com/documents/excel/2127-excel-pivot-table-count-unique-values.html#a1

Thank you!
This comment was minimized by the moderator on the site
Thank you so much !!!!!
This comment was minimized by the moderator on the site
I cannot edit after I save. Can yo tell me why?
This comment was minimized by the moderator on the site
sorry, this still doesn't provide a solution for me in excel 2010. You're =if(sumproduct() formula doesn't work. It misses the values for the if formula if you use it like you put it and it doesn't count unique values in my excel sheet if I add =if(>1,01;1;0)...
This comment was minimized by the moderator on the site
oh man... you saved me so so so much time !!!
thanks a lot !!!!
This comment was minimized by the moderator on the site
Distinct count Option not shown in summarize value by - Excel version 2013
This comment was minimized by the moderator on the site
Please verify that you have ticked the "Add this data to data model" check in the CreatePivot dialog box :)
This comment was minimized by the moderator on the site
I faced the same issue and then found the resolution.
Seems that it's available only when you tick the "Add this data to the Data Model" checkbox in the Create PivotTable dialog box.
Please try if that helps
This comment was minimized by the moderator on the site
same for me! Any suggestion?
This comment was minimized by the moderator on the site
These all work but only to an extent. I'm trying to find a solution for the issue with all of these. When I create a helper column and use the formula =IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))>1,0,1) I do indeed get the distinct count. But how do you resolve the issue were you need the pivot fields to include one of the lines of data where the formula gives a zero? I also tried using the Data Model and distinct count. This gives the correct count but when you double click the data to drill down you do not get the data specified in the pivot.
This comment was minimized by the moderator on the site
Amazing! thanks a tons - this worked for me on Excel 2016.
This comment was minimized by the moderator on the site
I don't see the Distinct Count under Summarize Value By tab. My "Add this data to the Data model" check box is also grey out. How can I change this setting?
This comment was minimized by the moderator on the site
Ran into the same issue... it is probably because the file you opened was as a csv. When I reopened my file as an excel file (either start a new one, copy+paste or save as), I have the functionality of adding to data model
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations