ThepExcel Logo
  • บทความ
    • Excel
      • Excel ทั่วไป
      • Excel Pivot Table
      • Excel Power Pivot
      • Power Query
      • Excel Array Formula
      • Excel VBA
      • Excel for Business
      • Excel and Maths
      • ฟังก์ชัน Excel ทั้งหมด
    • Power BI
      • Power Query
      • Data Model
      • DAX Formula
      • Power BI Report
    • Coding
      • Excel VBA
      • Python
      • Power Query M Code
    • AI
      • ChatGPT
      • Stable Diffusion
      • MidJourney
    • Highlights : บทความแนะนำ
    • คลิปวีดีโอ
  • อบรม
    • อบรมลูกค้าองค์กร
    • คอร์สออนไลน์ SkillLane
    • แนะนำวิทยากร
    • Excel/Power BI Skill Map
    • Quiz
  • Shop
    • คอร์สออนไลน์
    • สินค้าทั้งหมด
    • หนังสือเล่ม
    • E-Book
    • Cart
  • Download
    • Download ไฟล์จากเทพเอ็กเซล
    • ThepExcel-Mfx : M Code สำเร็จรูป
    • Date Table สำเร็จรูป
    • กราฟ My Skill
    • github.com/ThepExcel
  • รวม Link
    • รวม Link สอน Excel & Power BI ทั้งไทยและเทศ
    • รวม Link เกี่ยวกับ AI
    • รวม Link Coding
    • หนังสือแนะนำ
    • Facebook ThepExcel
    • YouTube ThepExcel
    • DAX Formatter
  • Contact
    • แนะนำ เทพเอ็กเซล (Thep Excel)
    • แนะนำวิทยากร : อาจารย์ ศิระ เอกบุตร (ระ)
    • นโยบายการคุ้มครองข้อมูลส่วนบุคคล (Privacy Policy)
  • Facebook
  • YouTube

เลิกใช้ Merge Cell กันเถอะ (แล้วจะให้ทำยังไงแทน?)

Categories 📂

Excel ทั่วไป, Highlights : บทความแนะนำ

Tags 🏷️

database, filter, merge cell, pivot, sort, table

“มาเลิกใช้ Merge Cell กันเถอะ!” นี่คือความในใจที่อยากจะตะโกนบอกคนใช้ Excel ทุกคนเลย 555

แต่ผมไม่ได้มาห้ามเฉยๆ นะ เพราะในบทความผมมีวิธีหลีกเลี่ยงที่พอจะช่วยลดปัญหาของ Merge Cell มาบอกด้วยล่ะ

หากผมจะบอกว่า “การ Merge Cell คือต้นกำเนิดของความเลวร้ายทั้งปวงใน Excel” มันอาจจะดูแรงเกินไปนิด แต่มันก็ใกล้เคียงล่ะ มาดูกันว่าทำไม…

สารบัญ

    • ปัญหาของการ Merge Cell
    • ทำไมคนยังใช้ Merge Cell?
    • ทำไม Excel ถึงไม่ยอมให้เรา Sort/Filter/Pivot ข้อมูลที่ Merge?
    • เวลาพูดว่าอย่า Merge Cell ที่ห้ามจริงๆ หมายถึงตัว Data Input ไม่ใช่ Report Output
  • วิธีที่พอจะช่วยหลีกเลี่ยง Merge Cell (ถ้ายังอยากทำ)
    • กรณีจะ Merge แนวนอน ให้ใช้ Center Across Selection แทน
    • กรณีจะ Merge แนวตั้ง ให้พิมพ์ให้ครบทุกช่องเถอะ ไม่มีทางเลือก
    • กรณี Merge หัวตาราง พอมีทางช่วยได้
    • เอายังไงกับตัวสรุปรวมท้ายตาราง

ปัญหาของการ Merge Cell

หากเรามีการใช้ Merge Cell ที่ตัวข้อมูลดิบที่เป็น Input จะพบว่ามันก่อให้เกิดปัญหามากมาย

Merge Cell
  • Merge แบบหัวตาราง 2 ชั้น (กรอบชมพูในรูปบน)
    • ทำให้เลือก Sort/Filter หัวตารางลำบาก ต้องเลือกทั้งแถวที่สองแล้วกด Filter เอาถึงจะเลือกหัวตารางชั้นล่างได้ ซึ่งยุ่งยากมาก
    • เอาข้อมูลเข้าไปวิเคราะห์ใน Pivot Table ก็ไม่ได้อีก (เพราะถือว่ามีชื่อ Field ว่าง)
  • การ Merge ที่ Data ข้างใน (กรอบแดงในรูปบน) จะทำให้
    • ไม่สามารถ Sort/Filter ข้อมูลที่มีการ Merge Cell ได้
  • Copy Paste ข้อมูลลงบน Merge Cell โดยที่ขนาดไม่เท่าเดิมก็ไม่ได้
  • แถมยังเป็นการเว้นช่องว่างเอาไว้ในฐานที่มนุษย์เข้าใจแต่คอมพิวเตอร์ไม่เข้าใจ (Computer เข้าใจว่าข้อมูลอยู่ที่ช่องซ้ายบนเท่านั้น นอกนั้นเป็นช่องว่าง)
  • การเขียนสูตรเพื่อเลือกข้อมูลช่องที่ถูก Merge แต่ไม่ใช่ช่องซ้ายบนก็ยากอีก

ทำไมคนยังใช้ Merge Cell?

จะเห็นว่าปัญหามากมายนั้นเกิดจากการใช้ Merge Cells แต่ทำไมคนถึงใช้มันอีกล่ะ??

คำตอบที่ผมพบจากการสอบถามเพื่อนๆ ในเพจ สามารถสรุปเหตุผลได้สั้นๆ ก็คือ เป็น “เพราะมันสวยดี”

ผมขอบอกเลยว่า ความงามที่ทำให้เกิดปัญหาตามมานั้น ย่อมไม่ใช่ความงามที่แท้ ดังนั้นผมขอแนะนำให้หลีกเลี่ยงการ Merge Cell ถ้าไม่จำเป็นจริงๆ

ผมเชื่อว่า คนที่ใช้ Merge Cell ส่วนใหญ่ไม่รู้ด้วยว่ามันจะส่งผลให้มีปัญหาในอนาคตแค่ไหน เพราะอาจจะไม่ค่อยเข้าใจการใช้ Sort/Filter/Table/Pivot Table

ทำไม Excel ถึงไม่ยอมให้เรา Sort/Filter/Pivot ข้อมูลที่ Merge?

ต้องเข้าใจด้วยว่าการที่เรา Merge ข้อมูลมันไม่ได้กระจายไปทุกช่อง แต่มันอยู่ที่ช่องซ้ายบนสุดแค่ช่องเดียว ดังนั้นช่องอื่นจะถือว่าเป็นช่องว่างทั้งหมด พอเป็นแบบนั้น มันก็เลยไม่อยากให้เรา Filter ยังไงล่ะ เดี๋ยวเข้าใจผิด

เวลาพูดว่าอย่า Merge Cell ที่ห้ามจริงๆ หมายถึงตัว Data Input ไม่ใช่ Report Output

หลักการที่ถูกต้องคือ แยกข้อมูลส่วน Input กับ Output ออกจากกันซะ ส่วน Input ที่เป็นข้อมูลดิบ ให้ทำให้อยู่ในลักษณะ Database ให้มากที่สุด (แต่ถ้ากรอกไม่ไหวจริงๆ ก็ใช้ Power Query ช่วย Fill Down/Unpivot แปลงหน้าตาได้ ถ้าทำเป็น) ส่วน Output ถ้าอยากจะ Merge ก็แล้วแต่ ไม่มีใครว่า (ยกเว้นวันจะต้องไปเป็น input ของชาวบ้านอีกที)

แปลว่า ถ้าเราจะ Merge เพื่อความสวยงาม ให้ทำที่ Output ซึ่งก็คือตัว Report ไม่ใช่ Input ที่เป็นแหล่งข้อมูลดิบ

วิธีที่พอจะช่วยหลีกเลี่ยง Merge Cell (ถ้ายังอยากทำ)

กรณีจะ Merge แนวนอน ให้ใช้ Center Across Selection แทน

เทคนิคนี้เป็นตัวที่สามารถสร้างผลลัพธ์ที่หน้าตาจะเหมือนกับ Merge Cell มากๆ (แต่ใช้รวม cell ได้แต่แนวนอน ใช้รวมแนวตั้งไม่ได้) มันคือการจัด Format ให้กับข้อมูลในแนวนอน โดยให้ข้อความมาอยู่ตรงกลางของพื้นที่ที่เลือกได้

ดังนั้นหากคุณต้องการจะ Merge Cell แค่แถวเดียว ให้เปลี่ยนมาใช้ Center Across Selection จะดีกว่ากันมากๆ เลย

วิธีทำก็แค่เลือกข้อมูล แบบที่ยังไม่ต้องMerge

จากนั้นก็คลิ๊กขวา Format Cell หรือกด Ctrl+1 ก็ได้

จากนั้นเลือก Alignment -> Horizontal : Center Across Selection

ผลที่ได้จะเหมือนกับการ Merge Cell เลย แต่ Cell ไม่ได้ Merge (เห็นมะว่ายังคลิ๊กเลือก cell แยกกันได้) ส่วนข้อมูลจริงจะยังคงอยู่ที่ช่องซ้ายสุดของพื้นที่ช่องเดียวเหมือนเดิม

ดังนั้นสรุปว่าถ้าจะ Merge Cell แนวนอนจริงๆ ก็ให้ใช้ Center Across Selection แทนนะ แต่ถ้าเลือกได้จริงๆ ก็อย่าไปทำมันเลยทั้งคู่นั่นแหละ ให้พิมพ์ข้อมูลให้ครบทุกช่องดีกว่า เพราะอย่างที่บอกไปว่าการ Merge ข้อมูลมันไม่ได้อยู่ครบทุกช่อง ไอ้เจ้า Center Across Selection ก็มีข้อมูลอยู่แต่ช่องซ้ายสุดเหมือนกัน เดี๋ยวก็มีปัญหาอีก

กรณีจะ Merge แนวตั้ง ให้พิมพ์ให้ครบทุกช่องเถอะ ไม่มีทางเลือก

การ Merge แนวตั้ง ใช้ Center Across Selection ไม่ได้นะ และไม่น่าจะมีวิธีที่ดีไปกว่านี้แล้วล่ะ เสียใจด้วย

กรณี Merge หัวตาราง พอมีทางช่วยได้

กรณีที่เรามีหัวตาราง 2 ชั้น มันทำให้ใช้ PivotTable ไม่ได้โดยสิ้นเชิง ดังนั้นวิธีแก้ที่ดีที่สุดคือ ทำหัวตารางให้มีแค่ชั้นเดียวพอ

ซึ่งถ้ารู้สึกว่าหัวตารางชั้นเดียวมันไม่สวยงาม งั้นก็ทำทั้งสองแบบ แต่เอาหัวตารางสองชั้นย้ายไปอยู่ข้างบนสิ เช่น เขียนสูตรเอาสองบรรทัดเชื่อมข้อความกันซะแบบนี้ ให้เหลือหัวตารางบรรทัดเดียว

และอย่าลืมทำลายข้อมูลที่ Merge อยู่ให้หมด (วิธีกำจัด Merge Cell ที่ง่ายที่สุดคือเลือกคลุมทั้งหมด แล้วกดปุ่ม Merge Cell อีกรอบ มันจะปลดออกหมดเลย) แล้วกรอกให้ครบทุกช่องซะ อย่าปล่อยว่างเลยและตัวสรุปรวมท้ายตารางให้ลบทิ้งไปก่อนทั้งบรรทัดเลย

จากนั้น Copy Paste Value ซะแล้วแก้บางคอลัมน์ที่อ่านไม่รู้เรื่องให้ถูกต้อง (ตัวที่ Merge ทั้งหลาย)

จากนั้นพอจะใช้งานจริง แล้วค่อยเลือกที่ช่อง C3 แล้วสั่ง Freeze Pane ซะแบบนี้

พอ Scroll Mouse ลงมา ไอ้ส่วนหัวตารางสองชั้นสวยๆ ของเราก็จะยังอยู่

แต่วิธีนี้เราจะได้ความสามารถของการ Sort/Filter กลับคือนมา และยังสามารถทำข้อมูลเป็น Table และใช้ PivotTable ได้ด้วย ทั้งนี้เพราะเราสร้างหัวตาราง 1 บรรทัดให้อยู่ติดกับตัวข้อมูลไว้แล้วนั่นเอง

เอายังไงกับตัวสรุปรวมท้ายตาราง

หากเราต้องการสรุปข้อมูลจริงๆ ควรจะใช้ Pivot Table ทำมากกว่าการมาเขียนสูตรเอาท้ายตาราง แต่ถ้าต้องการให้มีการสรุปข้อมูลอยู่ที่ท้ายตารางจริงๆ ผมแนะนำให้ใช้ความสามารถของ Table ครับ

ก่อนอื่นให้เลือกข้อมูลช่องใดช่องหนึ่งแล้วกด Insert->Table หรือ Ctrl+T เพื่อแปลงข้อมูลเป็น Table ซะ ซึ่งตอนแรกมันจะยังไม่มีตัวสรุปท้ายตารางให้

ถ้าอยากให้มีสรุปท้ายตาราง แค่ติ๊กเลือก Total Row ตามรูป ก็จะมีบรรทัดสรุปโผล่มา

จากนั้นเราสามารถเลือกแต่ละคอลัมน์ได้ว่าจะให้สรุปด้วยวิธีไหน เช่น SUM COUNT AVERAGE MAX MIN

เราได้ตารางที่หน้าตาไม่ได้แย่เลย มีหัวตาราง 2 ชั้นเหมือนเดิม มีบรรทัดสรุป แค่เนื้อในต้องพิมพ์ให้ครบทุกช่องเท่านั้นเอง เพื่อที่จะได้ Sort/Filter/Pivot ได้ตามปกติครับ

และทั้งหมดนี้ก็คือเทคนิค ที่พอจะช่วยหลีกเลี่ยงการทำ Merge Cell ได้นะครับ ถ้าทำตามนี้รับรองว่าชีวิตดีขึ้นแน่นอน ^^

แชร์ความรู้ให้เพื่อนๆ ของคุณ
11.6K    
11.6K    

ติดตามเทพเอ็กเซล

  • Facebook
  • YouTube

อบรมกับเทพเอ็กเซล

🔥 คอร์สใหม่ล่าสุด 🔥

การทำ Optimization ด้วย Excel Solver
สำหรับงานวางแผน
คอร์สออนไลน์ เทพเอ็กเซล
คอร์สออนไลน์ จากเทพเอ็กเซล ดูกี่รอบก็ได้
อบรม Excel / Power BI ให้องค์กรของคุณ

บทความล่าสุด

  • วิธีผสม Model สูตรผสมแบบโดนใจใน Stable Diffusion [Part7]
  • สอนทำรูปตัวเองคู่กับสาว ใน Stable Diffusion [Part6]
  • สอน Train Model ตัวเองใน Stable Diffusion [Part5]
  • 10 Levels การเขียนสูตร Excel ในยุคใหม่
  • บันได 10 ขั้น เริ่มเรียนรู้ M Code ขุมพลังของ Power Query
  • แนวทางฝึกฝน Excel ให้เก่งขึ้น
  • รวม Link เว็บ/เพจเกี่ยวกับ AI

บทความแนะนำ

🔥ฟังก์ชันทั้งหมดใน Excel 🔥

  • 10 Levels การเขียนสูตร Excel ในยุคใหม่
  • แกะเคล็ดวิชา Excel Wizard ในการแข่ง Speed Run Excel ระดับโลก
  • เจาะลึก CALCULATE ใน DAX แบบลึกสุดใจ : Part 1
  • Series สอนดึงข้อมูลจากเว็บ ด้วย Power Automate Desktop
  • สรุปการใช้ LAMBDA ฟังก์ชันที่ใช้สร้างฟังก์ชันใน Excel 365 และผองเพื่อน
  • วิธีใช้ Excel คำนวณระยะเวลาการทำงานรวม แถมระบุเวลาพักได้แบบยืดหยุ่น
  • วิธีจัดการข้อมูลแย่ๆ ด้วย Power Query ทั้งข้อมูลปนกัน ข้อมูลอยู่บนหัวตาราง

Categories

Tags

ai collection concepts copy database Data Model data validation date dax dropdown error excel filter finance find format formula function game graph IF index intro len link logic lookup match matrix mcode m code merge mid overview paste pivot power query row sort speed split stable diffusion substitute table text time tips trim vba vlookup

Archives

  • April 2023 (8)
  • March 2023 (2)
  • February 2023 (2)
  • January 2023 (1)
  • October 2022 (1)
  • September 2022 (3)
  • August 2022 (3)
  • July 2022 (1)
  • June 2022 (3)
  • May 2022 (1)
  • April 2022 (2)
  • February 2022 (1)
  • December 2021 (2)
  • November 2021 (10)
  • September 2021 (2)
  • August 2021 (6)
  • July 2021 (2)
  • June 2021 (2)
  • May 2021 (10)
  • April 2021 (3)
  • March 2021 (3)
  • February 2021 (4)
  • January 2021 (8)
  • December 2020 (5)
  • November 2020 (13)
  • October 2020 (5)
  • September 2020 (11)
  • August 2020 (4)
  • July 2020 (13)
  • June 2020 (17)
  • May 2020 (16)
  • April 2020 (16)
  • March 2020 (10)
  • February 2020 (15)
  • January 2020 (16)
  • December 2019 (4)
  • November 2019 (3)
  • October 2019 (9)
  • September 2019 (1)
  • August 2019 (7)
  • June 2019 (3)
  • May 2019 (9)
  • April 2019 (9)
  • March 2019 (2)
  • February 2018 (1)
  • January 2018 (3)
  • November 2017 (3)
  • August 2017 (1)
  • July 2017 (1)
  • June 2017 (1)
  • May 2017 (6)
  • April 2017 (6)
  • March 2017 (7)
  • February 2017 (1)
  • January 2017 (2)
  • December 2016 (1)
  • October 2016 (2)
  • September 2016 (3)
  • August 2016 (2)
  • July 2016 (2)
  • June 2016 (1)
  • May 2016 (1)
  • April 2016 (1)
  • March 2016 (2)
  • February 2016 (1)
  • January 2016 (2)
  • December 2015 (2)
  • November 2015 (5)
  • October 2015 (3)
  • June 2015 (2)
  • May 2015 (1)
  • April 2015 (26)
  • January 2015 (1)
  • December 2014 (1)
  • November 2014 (2)
  • October 2014 (1)
  • September 2014 (2)
  • August 2014 (1)
  • June 2014 (1)
  • May 2014 (1)
  • April 2014 (3)
  • March 2014 (3)
  • February 2014 (12)
  • January 2014 (7)
  • December 2013 (2)
  • November 2013 (8)
  • October 2013 (2)

เทพเอ็กเซล : Thep Excel

copyright © 2022

  • Facebook
  • YouTube
เว็บไซต์นี้ใช้คุกกี้ (Cookies)
บริษัท เทพเอ็กเซล จำกัด ให้ความสำคัญต่อข้อมูลส่วนบุคคลของท่าน เพื่อการพัฒนาและปรับปรุงเว็บไซต์รวมถึงสินค้าและบริการต่างๆ หากท่านใช้บริการเว็บไซต์นี้ โดยไม่มีการปรับตั้งค่าใดๆ แสดงว่าท่านยินยอมที่จะรับคุกกี้บนเว็บไซต์ และนโยบายสิทธิส่วนบุคคลของเรา
ตั้งค่าคุกกี้ยอมรับทั้งหมดอ่านเพิ่มเติม
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT