ไปยังเนื้อหาหลัก

วิธีซ่อนแถวตามค่าเซลล์ใน Excel

สมมติว่าคุณมีช่วงข้อมูลและต้องการซ่อนแถวตามค่าคอลัมน์ตัวอย่างเช่นหากค่าเซลล์ของคอลัมน์น้อยกว่า 3000 ให้ซ่อนแถวของเซลล์ตามภาพด้านล่างที่แสดง


ใน Excel คุณสามารถใช้ฟังก์ชันตัวกรองเพื่อกรองและซ่อนแถวตามค่าของเซลล์

1. เลือกข้อมูลที่คุณต้องการกรองแล้วคลิก ข้อมูล > ตัวกรอง. ดูภาพหน้าจอ:

doc ซ่อนแถวตามค่า 2

2. จากนั้นคลิกที่ลูกศรลงเพื่อแสดงรายการตัวกรองแบบเลื่อนลงจากนั้นคลิก ตัวกรองตัวเลข (หรือตัวกรองข้อความ) > มากกว่า (คุณสามารถเลือกเกณฑ์อื่น ๆ ที่ต้องการได้จากเมนูย่อย) ดูภาพหน้าจอ:

doc ซ่อนแถวตามค่า 3

3. ในกล่องโต้ตอบ popping ให้พิมพ์เกณฑ์ลงในกล่องข้อความที่อยู่ถัดจากมากกว่า ดูภาพหน้าจอ:

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 จากนั้นเลือกช่วงข้อมูลที่คุณต้องการซ่อนแถวในกล่องโต้ตอบ popping (ไม่รวมส่วนหัว) ดูภาพหน้าจอ:

doc ซ่อนแถวตามค่า 6

4 คลิก OKและพิมพ์หมายเลขเกณฑ์ในกล่องโต้ตอบที่สอง ดูภาพหน้าจอ:

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

ด้วย Kutools for Excel's เลือกเซลล์เฉพาะคุณสามารถเลือกเซลล์ตามเกณฑ์หนึ่งหรือสองครั้งได้ครั้งเดียว 
doc เลือกเซลล์เฉพาะ
 
Kutools for Excel: มีโปรแกรมเสริม Excel ที่มีประโยชน์มากกว่า 300 รายการให้ทดลองใช้ฟรีโดยไม่มีข้อ จำกัด ใน 30 วัน

หากคุณไม่ต้องการเปิดใช้งานฟังก์ชั่นตัวกรองหรือไม่ใช้ VBA ฉันขอแนะนำเครื่องมือที่มีประโยชน์ให้คุณที่นี่ - เลือกเซลล์เฉพาะ of Kutools สำหรับ Excel เพื่อเลือกแถวทั้งหมดอย่างรวดเร็วตามค่าของเซลล์จากนั้นคุณสามารถซ่อนได้

Kutools สำหรับ Excel, ที่มีมากกว่า 300 ฟังก์ชั่นที่มีประโยชน์ทำให้งานของคุณง่ายขึ้น 

หลังจาก ติดตั้งฟรี Kutools สำหรับ Excel โปรดทำดังนี้:

เคล็ดลับ หากคุณต้องการทดลองใช้ฟังก์ชัน Extract Text ฟรี โปรดไปทดลองใช้ Kutools for Excel ฟรี ก่อนแล้วไปใช้การดำเนินการตามขั้นตอนข้างต้น

1. เลือกช่วงข้อมูลและคลิก Kutools > เลือก > เลือกเซลล์เฉพาะ. ดูภาพหน้าจอ:

doc ซ่อนแถวตามค่า 14

2 ใน เลือกเซลล์เฉพาะ โต้ตอบตรวจสอบ ทั้งแถว ภายใต้ ประเภทการเลือก จากนั้นเลือกเกณฑ์ที่คุณต้องการ ประเภทเฉพาะ จากนั้นพิมพ์ตัวเลขหรือข้อความลงในกล่องข้อความ ดูภาพหน้าจอ:

doc ซ่อนแถวตามค่า 9

3 คลิก Ok > OK เพื่อปิดกล่องโต้ตอบ ตอนนี้มีการเลือกแถวที่มีข้อมูลน้อยกว่า 3000 และคุณต้องคลิกขวาที่ส่วนหัวของแถวเพื่อแสดงเมนูบริบทจากนั้นคลิกซ่อน ดูภาพหน้าจอ:
doc ซ่อนแถวตามค่า 10

ตอนนี้แถวที่ข้อมูลเล็กกว่า 3000 ถูกซ่อน

doc ซ่อนแถวตามค่า 11

เคล็ดลับ:

1. หากคุณต้องการซ่อนแถวที่มีค่าใดค่าหนึ่งคุณสามารถเลือกได้ ประกอบด้วย แล้วพิมพ์ค่าที่ต้องการลงในกล่องข้อความ

doc ซ่อนแถวตามค่า 12

2. หากคุณต้องการซ่อนแถวที่มีค่ามากกว่า แต่น้อยกว่าค่าคุณสามารถเลือกได้ มากกว่า และ น้อยกว่าจากนั้นพิมพ์ค่าลงในช่องสองช่องแล้วเลือก และ.

doc ซ่อนแถวตามค่า 13

ด้วย Kutools for Excel's เลือกเซลล์เฉพาะ ยูทิลิตี้คุณสามารถระบุตำแหน่งของเซลล์ที่ต้องการเลือกทั้งแถวหรือคอลัมน์ตามค่าของเซลล์และอื่น ๆ คลิกที่นี่เพื่อทราบข้อมูลเพิ่มเติมเกี่ยวกับยูทิลิตี้นี้

Kutools for Excel: 300+ ฟังก์ชันที่คุณต้องมีใน Excel ทดลองใช้ฟรี 30 วันจากที่นี่

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, 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