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

วิธีการรวมเฉพาะเซลล์ที่กรองหรือมองเห็นได้ใน Excel

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


รวมเฉพาะค่าเซลล์ที่กรองหรือมองเห็นได้ด้วยสูตร

ด้วยสิ่งนี้ SUBTOTAL ฟังก์ชันที่ไม่สนใจแถวที่ถูกยกเว้นโดยตัวกรองคุณสามารถเพิ่มเฉพาะเซลล์ที่มองเห็นได้อย่างง่ายดาย คุณสามารถทำได้ดังนี้:

สมมติว่าคุณมีข้อมูลจำนวนหนึ่งและได้รับการกรองตามที่คุณต้องการโปรดดูภาพหน้าจอ:

1. ในเซลล์ว่างตัวอย่างเช่น C13 ป้อนสูตรนี้: = ผลรวมย่อย (109, C2: C12) (109 ระบุเมื่อคุณรวมตัวเลขค่าที่ซ่อนอยู่จะถูกละเว้น C2: C12 คือช่วงที่คุณจะรวมโดยไม่สนใจแถวที่กรอง) และกดปุ่ม เข้าสู่ กุญแจ

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

เซลล์ / แถว / คอลัมน์ที่มองเห็นได้รวม / ค่าเฉลี่ยในช่วงที่ระบุโดยละเว้นเซลล์ / แถว / คอลัมน์ที่ซ่อนหรือกรอง

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


ผลรวมโฆษณานับเซลล์ที่มองเห็นได้โดยเฉลี่ยเท่านั้น

รวมเฉพาะค่าเซลล์ที่กรองหรือมองเห็นได้ด้วย User Defined Function

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

1. กด ALT + F11 และจะเปิดไฟล์ Microsoft Visual Basic สำหรับแอปพลิเคชัน หน้าต่าง

2. คลิก สิ่งที่ใส่เข้าไป > โมดูลและวางรหัสต่อไปนี้ในหน้าต่างโมดูล

Function SumVisible(WorkRng As Range) As Double
'Update 20130907
Dim rng As Range
Dim total As Double
For Each rng In WorkRng
    If rng.Rows.Hidden = False And rng.Columns.Hidden = False Then
        total = total + rng.Value
    End If
Next
SumVisible = total
End Function

3. บันทึกรหัสนี้และป้อนสูตร = SumVisible (C2: C12) ลงในเซลล์ว่าง ดูภาพหน้าจอ:

4. จากนั้นกด เข้าสู่ ที่สำคัญและคุณจะได้รับผลลัพธ์ที่คุณต้องการ


รวม / นับ / เฉลี่ยเฉพาะเซลล์ที่กรองหรือมองเห็นได้ด้วย Kutools for Excel

หากคุณติดตั้ง Kutools for Excel ไว้คุณสามารถคำนวณผลรวม / จำนวน / ค่าเฉลี่ยเฉพาะเซลล์ที่มองเห็นได้หรือกรองออกใน Excel ได้อย่างง่ายดาย

Kutools สำหรับ Excel - เพิ่มประสิทธิภาพ Excel ด้วยเครื่องมือที่จำเป็นมากกว่า 300 รายการ เพลิดเพลินกับฟีเจอร์ทดลองใช้ฟรี 30 วันโดยไม่ต้องใช้บัตรเครดิต! Get It Now

ตัวอย่างเช่นคุณต้องการรวมเฉพาะเซลล์ที่มองเห็นได้เท่านั้นโปรดเลือกเซลล์ที่คุณจะวางผลรวมไว้ที่พิมพ์สูตร = สรุปได้ (C3: C12) (C3: C13 คือช่วงที่คุณจะรวมเฉพาะเซลล์ที่มองเห็นได้) เข้าไปในนั้นแล้วกดปุ่ม เข้าสู่ กุญแจ

จากนั้นผลสรุปจะคำนวณโดยไม่สนใจเซลล์ที่ซ่อนอยู่ทั้งหมด ดูภาพหน้าจอ:

สำหรับการนับเฉพาะเซลล์ที่มองเห็นได้โปรดใช้สูตรนี้ = COUNTVISIBLE (C3: C12); สำหรับการหาค่าเฉลี่ยเฉพาะเซลล์ที่มองเห็นได้โปรดใช้สูตรนี้ = ค่าเฉลี่ย (C3: C12).

หมายเหตุ หากคุณจำสูตรไม่ได้ทั้งหมดคุณสามารถทำตามขั้นตอนด้านล่างเพื่อรวม / นับ / เฉลี่ยเฉพาะเซลล์ที่มองเห็นได้อย่างง่ายดาย:

1. เลือกเซลล์ที่คุณจะวางผลการสรุปแล้วคลิก Kutools > ฟังก์ชั่น > สถิติและคณิตศาสตร์ > สรุปได้ (หรือ ปกติ, สามารถมองเห็นได้ ตามที่คุณต้องการ) ดูภาพหน้าจอ:

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

Kutools สำหรับ Excel - เพิ่มประสิทธิภาพ Excel ด้วยเครื่องมือที่จำเป็นมากกว่า 300 รายการ เพลิดเพลินกับฟีเจอร์ทดลองใช้ฟรี 30 วันโดยไม่ต้องใช้บัตรเครดิต! Get It Now

จากนั้นผลสรุปจะคำนวณโดยไม่สนใจเซลล์ที่ซ่อนอยู่ทั้งหมด


Demo: Sum / Count / Average เฉพาะเซลล์ที่กรองหรือมองเห็นได้


Kutools สำหรับ Excel: เครื่องมือแสนสะดวกกว่า 300 รายการอยู่แค่เพียงปลายนิ้วสัมผัส! เริ่มทดลองใช้ฟรี 30 วันโดยไม่มีข้อจำกัดด้านฟีเจอร์ตั้งแต่วันนี้ Download Now!

รวม / นับเฉพาะเซลล์ที่กรองออก / มองเห็นได้อย่างง่ายดายโดยการลบแถวที่ซ่อนอยู่ใน Excel

เมื่อการรวม / การนับที่กรองเซลล์ออกใน Excel ฟังก์ชัน SUM หรือฟังก์ชัน Count จะไม่เพิกเฉยต่อเซลล์ที่ซ่อนอยู่ หากแถวที่ซ่อน / กรองถูกลบออกเราสามารถรวมหรือนับเซลล์ที่มองเห็นได้อย่างง่ายดายเท่านั้น คุณสามารถลองใช้ Kutools for Excel's ลบแถวและคอลัมน์ที่ซ่อน (มองเห็นได้) ยูทิลิตี้ในการแก้ปัญหา


โฆษณาลบคอลัมน์แถวที่ซ่อนอยู่ 3

บทความที่เกี่ยวข้อง:

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

🤖 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 (26)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour,
Moi j'ai un problème comparable mais différent, en gros quand je filtre mes colonnes et que je veux copier la même valeur dans mes lignes visibles, toute les lignes qui sont entre mes lignes visibles sont elles aussi modifiées.
Comment faire pour que seule mes lignes visibles soient modifiés.
This comment was minimized by the moderator on the site
Hello, Loux

Do you mean to copy and paste cell vaues to visible cells only? If so, maybe the below articles can help you:
https://www.extendoffice.com/documents/excel/2331-excel-paste-data-into-filtered-list.html
https://www.extendoffice.com/documents/excel/2617-excel-paste-to-visible-filtered-cells.html

Please try it, thank you!
This comment was minimized by the moderator on the site
Hola,

No me resulta sumar el rango de una fila considerando sólo las columnas visibles.

Alguna formula o alguna macro?

Gracias!!!
This comment was minimized by the moderator on the site
Hello, Cristobal,
Sorry, I can't understand your problem clearly, could you explain your problem in English?
Or you can insert a screenshot or a file to describe your problem.
Thank you!
This comment was minimized by the moderator on the site
Hola,

Quiero sumar dentro de un rango de fila que al ocultar columnas sume sólo las visibles.
No he logrado hacerlo, alguna fórmula? o tendría que hacerse con una marcro?

Muchas gracias!!!
This comment was minimized by the moderator on the site
how to skip hidden cells from excel formulae in filtered sheet....

yellow coloured cells are involving hidden cells due to filter....
This comment was minimized by the moderator on the site
Hi,
What kinds of calculation do you need to do? Kutools for Excel supports three functions to count/sum/average ignoring all hidden cells.
This comment was minimized by the moderator on the site
or like this



column a column d

100 10

90 10

80 10



where 90=100-10, 80=90-10, and so on.........

dragging the formula includes hidden cells in formula
This comment was minimized by the moderator on the site
When i am applying say G3-K2 Formula in filtered excel sheet & dragging the formula, it includes hidden cells

for example



Validity Lifting Qty
27054.59 123.41
26931.18 330.98
26600.20 493.66
26106.54 476.38
25630.16 480.64
25149.52 577.06


now value in validity comes after get subtracted by lifted qty (like 2nd value 26931.18=27054.59-123.41)

3rd value in validity=2nd value in validity-2nd value in lifted qty. and so on.....

now this sheet is filtered & when i drag the formulae in validity column, it includes hidden cells, due to filter.

which gives me wrong result
This comment was minimized by the moderator on the site
Validity Lifting Qty
27054.59 123.41
26931.18 330.98
26600.20 (26600.2=26931.18-330.98) 493.66
26106.54 476.38
25630.16 480.64
25149.52 577.06
This comment was minimized by the moderator on the site
When i am applying say G3-K2 Formula in filtered excel sheet & dragging the formula, it includes hidden cells

for example



Validity Lifting Qty
27054.59 123.41
26931.18 330.98
26600.20 493.66
26106.54 476.38
25630.16 480.64
25149.52 577.06


now value in validity comes after get subtracted by lifted qty (like 2nd value 26931.18=27054.59-123.41)

3rd value in validity=2nd value in validity-2nd value in lifted qty. and so on.....

now this sheet is filtered & when i drag the formulae in validity column, it includes hidden cells, due to filter.

which gives me wrong result
This comment was minimized by the moderator on the site
Hi,
The normal =G3-K2 will not ignore any hidden cells/rows/column by dragging to copy. I am sorry I can not figure out a proper formula for your. All formulas or methods talked in this article is just about sum/count/average ignoring hidden cells.
This comment was minimized by the moderator on the site
how i can skip hidden cells from excel formulae in filtered sheet
This comment was minimized by the moderator on the site
Im trying to use the AVERAGEVISIBLE function to average the 12 largest values in a column, this works in the normal AVERAGE function as =AVERAGE(LARGE(E971:E1540,{1,2,3,4,5,6,7,8,9,10,11,12})) however when i try to use the average visible function it returns #VALUE!, any ideas?
This comment was minimized by the moderator on the site
This is awesome! Thanks so much.
This comment was minimized by the moderator on the site
Sorry I messed up the posts security code at bottom and seems like my question may have been deleted as it asked me to try another one. I can get the VBA code for SUMVISIBLE to work well if my data is vertical and I hide rows. However it doesn't if my data runs horizontal and I want to hide columns. Is there a way to program this? Thanks!
This comment was minimized by the moderator on the site
I am able to get your VBA for =SUMVISIBLE above to work good. However just if my data runs vertically and I am hiding rows. Is there a way to program it so you can have your data run horizontally and it still work when you hide columns? THANKS!
This comment was minimized by the moderator on the site
The solution worked for me. :D
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