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

วิธีการนับแถวจนกว่าจะถึงค่าผลรวมใน Excel

ตัวอย่างเช่นมีข้อมูลอยู่ช่วงหนึ่งคอลัมน์ A ประกอบด้วยหมายเลขผลิตภัณฑ์และคอลัมน์ B มีจำนวนคำสั่งซื้อและคุณมีค่าบางอย่างเช่น 80 ซึ่งเป็นจำนวนรวมของหมายเลขลำดับที่ n แรกในคำสั่งซื้อคุณจะนับจำนวนได้อย่างไร แถวมีส่วนเกี่ยวข้องกับผลรวม 80 ตามภาพด้านล่างที่แสดง
นับเอกสารจนกว่าผลรวมจะถึง 1

นับแถวจนกว่าจะถึงค่าผลรวมที่แน่นอนด้วยสูตร


ลูกศรสีฟ้าฟองขวา นับแถวจนกว่าจะถึงค่าผลรวมที่แน่นอนด้วยสูตร

หากต้องการนับจำนวนแถวที่ใช้เพื่อสรุปค่าที่ตรงกันคุณสามารถใช้สูตรได้

เลือกเซลล์ว่างตัวอย่างเช่น E2 แล้วป้อนสูตรนี้ =MATCH(D2,SUBTOTAL(9,OFFSET(B2,,,ROW(B2:B17)-ROW(B2))),1)กด Shift + Ctrl + Enter กุญแจสำคัญเพื่อให้ได้ผลลัพธ์ที่ถูกต้อง ดูภาพหน้าจอ:
นับเอกสารจนกว่าผลรวมจะถึง 2

ปลาย: ในสูตรนี้ D2 คือค่าบางค่าที่คุณต้องการเข้าถึงโดยการสรุป B2: B17 คือช่วงค่าที่คุณรวมเข้าด้วยกันคุณสามารถเปลี่ยนแปลงได้ตามต้องการ

หากคุณต้องการยกเว้นแถวส่วนหัวคุณสามารถใช้สูตรนี้ได้ =MATCH(D2,SUBTOTAL(9,INDIRECT("$B$1"&":"&ADDRESS(ROW($B$1:$B$17),COLUMN($B$1))))และกดปุ. ม  Shift + Ctrl + Enter คีย์พร้อมกัน

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

🤖 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 (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi, how would the formula be if instead of D2 I want it to be an established range of data?
This comment was minimized by the moderator on the site
MATCH(D2,SUBTOTAL(9,OFFSET(B2,,,ROW(B2:B17)-ROW(B2))),1)this formula is not working on google sheets any info about that
This comment was minimized by the moderator on the site
Hi, Suresh, above formula only work in Microsoft Excel, if you want to count rows until a target sum reach in google sheet, you need a helper column, and the COUNTIF function. Specific operations as below screenshot shown. Please let me know if this help you.
This comment was minimized by the moderator on the site
hi , what can be the formula but to count columns?
This comment was minimized by the moderator on the site
Hello, Diane, just change ROW to COLUMN in the formula like =MATCH(A2,SUBTOTAL(9,OFFSET(A1,,,COLUMN(A1:E1)-COLUMN(B2))),1). See screenshot:
This comment was minimized by the moderator on the site
This doesn't work - I think it's because subtotal only works vertically?
This comment was minimized by the moderator on the site
After reading this solution, I started reading about array formulas. Very interesting and useful. With respect to this solution, it solves a very challenging aspect of material stockpile size and composition tracking. Can you help me with one little change...I want the position in the list of the total going from the bottom of the list up vs top down in your example. I've tried a few things but not cracked it yet, mainly due to not fully understanding the formula syntax yet. Any suggestions? Particularly interested in the exclude header version, or a version that does not include any header consideration since I wish to calculate this fresh on each row (i.e. day.)
This comment was minimized by the moderator on the site
Never mind. I figured out a simple, non array way to do what I wanted to do.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations