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

Excelでセル値に基づいて行を非表示にする方法は?

データの範囲があり、列の値に基づいて行を非表示にする場合、たとえば、列のセル値が3000より小さい場合は、次のスクリーンショットに示すようにセルの行を非表示にします。


Excelでは、フィルター機能を使用して、セル値に基づいて行をフィルター処理および非表示にできます。

1.除外するデータを選択し、をクリックします 且つ > フィルタ。 スクリーンショットを参照してください:

docは値2に基づいて行を非表示にします

2.次に、下矢印をクリックしてフィルターのドロップダウンリストを表示し、[ 数値フィルター(またはテキストフィルター) > より大きい (サブメニューから必要な他の基準を選択できます)。 スクリーンショットを参照してください:

docは値3に基づいて行を非表示にします

3.ポップダイアログで、[より大きい]の横のテキストボックスに基準を入力します。 スクリーンショットを参照してください:

docは値4に基づいて行を非表示にします

4。 クリック OK。 これで、3000より大きいデータのみが表示され、データが3000より小さい行は非表示になります。

docは値5に基づいて行を非表示にします


さらに、VBAコードに興味がある場合は、ここでセル値に基づいて行を非表示にするVBAコードを紹介します。

1。 押す Altキー+ F11 有効にするキー アプリケーション向け Microsoft Visual Basic 窓。

2。 次に、をクリックします インセット > モジュール 新しいを開くには モジュール ウィンドウをクリックし、VBAコードの下に貼り付けます。

VBA:セルの値に基づいて行を非表示にします。

Sub HideRow()
'Updateby20150618
Dim Rng As Range
Dim WorkRng As Range
Dim xNumber As Integer
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xNumber = Application.InputBox("Number", xTitleId, "", Type:=1)
For Each Rng In WorkRng
    Rng.EntireRow.Hidden = Rng.Value < xNumber
Next
End Sub

3.次にを押します F5 キーを押してVBAを実行し、行を非表示にするデータ範囲をポップダイアログに選択します(ヘッダーを除く)。 スクリーンショットを参照してください:

docは値6に基づいて行を非表示にします

4。 クリック OK、およびXNUMX番目のダイアログに基準番号を入力します。 スクリーンショットを参照してください:

docは値7に基づいて行を非表示にします

5。 クリック OK。 これで、データが3000未満の行が非表示になります。

ヒント: 3000を超える行を非表示にする場合は、変更するだけです。 Rng.EntireRow.Hidden = Rng.Value <xNumber 〜へ Rng.EntireRow.Hidden = Rng.Value> xNumber、またはデータが3000に等しい行を非表示にする場合は、次のように変更します。 Rng.EntireRow.Hidden = Rng.Value = xNumber.


Excelの基準に基づいてセルをすばやく選択する

Excel用のKutoolsを使用 特定のセルを選択、XNUMX回またはXNUMXつの基準に基づいてセルを選択できます。 
docは特定のセルを選択します
 
Kutools for Excel:300を超える便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。

フィルタ機能を有効にしたくない場合、VBAも有効にしたくない場合は、ここで便利なツールを紹介します– 特定のセルを選択 of Kutools for Excel セルの値に基づいて行全体をすばやく選択するには、それらを非表示にすることができます。

Kutools for Excel, 以上で 300 便利な機能は、あなたの仕事をより簡単にします。 

無料インストール Kutools for Excel、以下のようにしてください:

ヒント。 テキストの抽出機能を無料で試用したい場合は、 無料でKutoolsforExcelをお試しください まず、上記の手順に従って操作を適用します。

1.データ範囲を選択し、をクリックします クツール > 選択 > 特定のセルを選択。 スクリーンショットを参照してください:

docは値14に基づいて行を非表示にします

2。 の中に 特定のセルを選択 ダイアログ、チェック 行全体 選択タイプ セクションから、必要な基準を選択します 特定のタイプ リストを表示し、番号またはテキストをテキストボックスに入力します。 スクリーンショットを参照してください:

docは値9に基づいて行を非表示にします

3。 クリック Ok > OK ダイアログを閉じます。 これで、データが3000未満の行が選択されました。行ヘッダーを右クリックしてコンテキストメニューを表示し、[非表示]をクリックするだけです。 スクリーンショットを参照してください:
docは値10に基づいて行を非表示にします

これで、データが3000未満の行が非表示になります。

docは値11に基づいて行を非表示にします

ヒント:

1.特定の値を含む行を非表示にする場合は、 含まれています テキストボックスに特定の値を入力します。

docは値12に基づいて行を非表示にします

2.値よりも大きいが小さい値を含む行を非表示にする場合は、 越える & 以下、次に値をXNUMXつのボックスに入力し、チェックします .

docは値13に基づいて行を非表示にします

Excel用のKutoolsを使用 特定のセルを選択 ユーティリティを使用すると、特定のセルの場所を識別したり、セルの値に基づいて行または列全体を選択したりできます。 このユーティリティの詳細については、ここをクリックしてください。

Excel用Kutools: Excelに必要な300以上の関数, ここから30日間の無料トライアル。

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

🤖 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 (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Yes, "Entire Row" is selected.
This comment was minimized by the moderator on the site
All rows remain selected without using Kutools. As soon as I use Kutools and select header row, all other rows but the header row de-select.
This comment was minimized by the moderator on the site
Are you sure check the Entire row option in the dialog? If you check cell option, the selected cells will be unselected when you right click at one row.
https://www.extendoffice.com/images/stories/comments/sun-comment/doc-select-specific-cell-1.png
This comment was minimized by the moderator on the site
Hi - I'm using a newer Lenovo PC with Windows 10 Professional and Microsoft 365 Apps for business. Excel Version 2210 (Build 15726.20202 Click-to-Run).
This comment was minimized by the moderator on the site
I have tried the operation in the same version with you, there is no any problem. Could you try to manually select several rows (without using Kutools for Excel), then right click at one row header, see all rows are remained selecting?
This comment was minimized by the moderator on the site
I have done exactly what you've demonstrated. However, when I right-click on the row header, all other rows become de-selected and only that one row remains selected to be hidden or deleted. No matter what I do, the other rows do not stay selected when right-clicking on the header. I'm at a loss to know what to do now.
This comment was minimized by the moderator on the site
I am so sorry for that. Could you tell me what Excel version and system you use?
This comment was minimized by the moderator on the site
Hello,

That is exactly what I've been doing, however, it only hides the row on which I have clicked the row header. All other selected rows remain unhidden, and are deselected at the same time. I will try it again following your gif exactly. Thanks for your reply.
This comment was minimized by the moderator on the site
I'm using Kutools to select entire rows based on a value, and it does select all the rows with that value. However, when I right-click on the row header and click on "Hide" in the menu, only that row is hidden and the rest that were selected become de-selected. It appears I still have to hide each row one at a time. What am I doing wrong?
This comment was minimized by the moderator on the site
Hi, Rochelley, I think there may be some wrong when you right-click at the row header. After the rows which match your condition are selecetd after applying the feature, right click at one row header of them, note that other rows are kept selected, then choose hide from the context menu. Please see the gif:
https://www.extendoffice.com/images/stories/comments/sun-comment/doc-hide-selected-row.gif
This comment was minimized by the moderator on the site
Hello,

I have a drop down with multiple reponses. I am trying to hide certain rows dependant on the response, can someone please assist?

Dropdown options are "CDI", "AR", "Legal", "Multiple" and "Other".

If response is CDI then hide rows 42-100

If response is AR then hide rows 19-41 and rows 66-100

If response is Legal then hide rows 19-66 and rows 88-100

If response is multiple then don't hide anything

If response is Other then hide rows 19-88



Can someone please asssist?
This comment was minimized by the moderator on the site
Hi I need some help with my work sheet. I have to build a dynamic questionnaire and I need to have a code that allow me to hide/ Unhide automatically some rows base on a cell information. Example:

if c6 is "internally" then show me row 7 but hide 8 to 107
if c6 is "Externally" then hide all the rows from 7 to 107


if c7 is "yes" then show me row 8 but hide 9 to 107
if c7 is "No" then show me row 8 but hide 9 to 107
if c8 is "Critical" then show me row 9 but hide 10 to 107

if c8 is "Important" show me row 9 but hide 10 to 107
if c8 is "Ordinary" show me row 9 but hide 10 to 107
if c8 is "Other" then show me row 9 but hide 10 to 107

if c9 is "Critical" then show me row 10 but hide 11 to 107
if c9 is "Important" then show me row 10 but hide 11 to 107
if c9 is "Ordinary" then show me row 10 but hide 11 to 107
if c9 is "Other" then show me row 10 but hide 11 to 107

etc.

can somebody help me?
This comment was minimized by the moderator on the site
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Row = 1 Then

If Target.Value = "YES" Then
Worksheets(2).Activate
Worksheets(2).Application.Columns("A:Z").Select
Worksheets(2).Application.Selection.EntireColumn.Hidden = True
Worksheets(2).Application.Columns("AA:AZ").Select
Worksheets(2).Application.Selection.EntireColumn.Hidden = False
ElseIf Target.Value = "NO" Then
Worksheets(2).Activate
Worksheets(2).Application.Columns("AA:AZ").Select
Worksheets(2).Application.Selection.EntireColumn.Hidden = True
Worksheets(2).Application.Columns("A:Z").Select
Worksheets(2).Application.Selection.EntireColumn.Hidden = False
Else
Worksheets(2).Activate
Worksheets(2).Application.Columns("A:Z").Select
Worksheets(2).Application.Selection.EntireColumn.Hidden = False
Worksheets(2).Application.Columns("AA:AZ").Select
Worksheets(2).Application.Selection.EntireColumn.Hidden = False
End If

End If
End Sub
This comment was minimized by the moderator on the site
I got same error
This comment was minimized by the moderator on the site
Sorry I do not know either.
This comment was minimized by the moderator on the site
I don't know either Sunny
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