voraphon.com / บทความ | Articles

ซ่อนค่าซ้ำใน Excel เหลือไว้ตัวแรก ไม่ต้องใช้ตัวอักษรสีขาว

Hide Repeated Values in Excel – Keep the First One, No White Font

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

ENThis trick hides values that repeat the row above. The data is still there. It works on any background colour.

1. ปัญหาที่ผมเจอ | The Problem

THผมจดงานประจำวันใน Excel วันหนึ่งมีหลายแถว วันที่เลยซ้ำกันเต็มคอลัมน์ ดูแล้วลายตา

ผมหาวิธีซ่อนวันที่ซ้ำอยู่นาน เจอแต่วิธี "เปลี่ยนตัวอักษรเป็นสีขาว"

วิธีนี้ใช้ได้แค่ตอนพื้นเป็นสีขาว พอตารางมีแถวสลับสี หรือมีแถวที่ไฮไลต์ไว้ ตัวอักษรสีขาวก็โผล่ให้เห็น

วิธีที่ได้ผลจริงคือ ใช้รูปแบบตัวเลข ;;; ใน Conditional Formatting วิธีนี้ไม่ต้องยุ่งกับสีเลย

ENI keep a daily work log in Excel. Each day has several rows, so the Date column is full of repeats. It's hard to read.

I searched for a long time. Every tip said "make the font white". That only works on a white background.

On banded rows or highlighted rows, the white text shows up.

What actually works is a ;;; number format inside Conditional Formatting. No colours needed.

2. ก่อน / หลัง | Before / After

ก่อน/หลัง | Before/After
ก่อน/หลัง | Before/After

ก่อน | Before

วันที่DateงานหลักMain Taskงานย่อยSubtaskสถานะStatus
01/03/2026T0001 | ปรับปรุงเว็บไซต์Website Revampออกแบบหน้าแรกDesign homepage3.เสร็จแล้วDone
01/03/2026T0001 | ปรับปรุงเว็บไซต์Website RevampทำเมนูBuild menu2.กำลังทำIn progress
01/03/2026T0002 | รายงานประจำเดือนMonthly ReportรวบรวมยอดขายCollect sales3.เสร็จแล้วDone
02/03/2026T0001 | ปรับปรุงเว็บไซต์Website RevampทำเมนูBuild menu3.เสร็จแล้วDone
02/03/2026T0002 | รายงานประจำเดือนMonthly Reportสรุปค่าใช้จ่ายSummarise expenses2.กำลังทำIn progress
02/03/2026T0003 | อบรมพนักงานใหม่Staff Trainingเตรียมสไลด์Prepare slides1.ค้างPending

หลัง | After

วันที่DateงานหลักMain Taskงานย่อยSubtaskสถานะStatus
01/03/2026T0001 | ปรับปรุงเว็บไซต์Website Revampออกแบบหน้าแรกDesign homepage3.เสร็จแล้วDone
ทำเมนูBuild menu2.กำลังทำIn progress
T0002 | รายงานประจำเดือนMonthly ReportรวบรวมยอดขายCollect sales3.เสร็จแล้วDone
02/03/2026T0001 | ปรับปรุงเว็บไซต์Website RevampทำเมนูBuild menu3.เสร็จแล้วDone
T0002 | รายงานประจำเดือนMonthly Reportสรุปค่าใช้จ่ายSummarise expenses2.กำลังทำIn progress
T0003 | อบรมพนักงานใหม่Staff Trainingเตรียมสไลด์Prepare slides1.ค้างPending

THเซลล์ที่ดูว่าง จริงๆ ยังมีข้อมูลอยู่ ลองคลิกแล้วดูที่ Formula Bar

ENThe "empty" cells still have data. Click one and look at the Formula Bar.

3. วิธีที่คนนิยมใช้ และทำไมมันไม่เวิร์ก | Common Methods and Why They Fail

3.1 กฎ Duplicate Values

THHome → Conditional Formatting → Highlight Cells Rules → Duplicate Values

❌ Excel มองว่าค่าซ้ำทุกตัวคือค่าซ้ำ รวมถึงตัวแรกด้วย เลยซ่อนหมดทั้งกลุ่ม ไม่เหลือตัวแรกให้เห็น

ENHome → Conditional Formatting → Highlight Cells Rules → Duplicate Values

❌ Excel marks every copy as a duplicate, including the first. The whole group disappears.

3.2 สูตร + ตัวอักษรสีขาว | Formula + White Font

THใช้สูตร =A2=A1 แล้วตั้งตัวอักษรเป็นสีขาว

  • ✅ ใช้ได้บนพื้นขาว
  • ❌ พอพื้นมีสี เช่น แถวสลับสีของ Table หรือแถวที่ไฮไลต์สีเหลือง ตัวอักษรสีขาวจะโผล่ให้เห็น
  • ❌ ถ้าเปลี่ยนสีพื้นทีหลัง ต้องตามไปแก้สีตัวอักษรทุกกฎ

ENUse =A2=A1 and set the font to white.

  • ✅ Works on white.
  • ❌ Shows up on coloured rows, like Table banding or a yellow highlight.
  • ❌ Change the fill later, and you must fix every rule again.
ตัวอักษรสีขาวโผล่บนแถวสลับสี | White text showing on banded rows
ตัวอักษรสีขาวโผล่บนแถวสลับสี | White text showing on banded rows

4. ตัวอย่างที่ 1: ซ่อนวันที่ซ้ำ | Example 1: Hide Repeated Dates

ตารางตัวอย่าง | Sample table: หัวตารางอยู่แถว 1, วันที่อยู่คอลัมน์ A, ข้อมูลอยู่ A2:A20

Headers in row 1, dates in column A, data in A2:A20.

ขั้นตอน | Steps

#ภาษาไทยEnglish
1เรียงข้อมูลตามวันที่ก่อนSort by Date first
2ลากเลือก A2:A20 โดยเริ่มที่ A2Select A2:A20, starting at A2
3Home → Conditional Formatting → New RuleHome → Conditional Formatting → New Rule
4เลือก Use a formula to determine which cells to formatChoose Use a formula to determine which cells to format
5ใส่สูตร =AND(A2<>"",A2=A1)Enter =AND(A2<>"",A2=A1)
6กด Format… → แท็บ Number → CustomClick Format… → Number tab → Custom
7ช่อง Type พิมพ์ ;;; (เซมิโคลอน 3 ตัว)In Type, enter ;;; (3 semicolons)
8กด OK → OKClick OK → OK
ขั้นตอนที่ 5: สูตร | Step 5: formula=AND(A2<>"",A2=A1)
ขั้นตอนที่ 7: Custom number format | Step 7: custom number format;;;
ขั้นตอนที่ 5: ใส่สูตร | Step 5: enter the formula
ขั้นตอนที่ 5: ใส่สูตร | Step 5: enter the formula
ขั้นตอนที่ 7: ใส่ ;;; | Step 7: enter ;;;
ขั้นตอนที่ 7: ใส่ ;;; | Step 7: enter ;;;

สูตรนี้แปลว่าอะไร | What the Formula Means

ส่วน PartภาษาไทยEnglish
A2=A1แถวนี้เหมือนแถวบนไหมSame as the row above?
A2<>""เซลล์นี้ไม่ว่างThe cell is not empty
AND(...)ซ่อนเมื่อเข้าเงื่อนไขทั้งสองข้อHide only when both are true

ทำไม ;;; ถึงซ่อนได้ | Why ;;; Works

THรูปแบบตัวเลขแบบ Custom แบ่งเป็น 4 ช่อง คั่นด้วย ; คือ บวก ; ลบ ; ศูนย์ ; ข้อความ

;;; คือไม่ใส่อะไรเลยทั้ง 4 ช่อง Excel เลยไม่แสดงอะไร ไม่ว่าพื้นจะเป็นสีอะไร

ENA custom number format has 4 parts split by ;: positive ; negative ; zero ; text.

;;; leaves all 4 empty, so Excel shows nothing, on any background.

5. ตัวอย่างที่ 2: ซ่อนชื่องานซ้ำ แต่ขึ้นใหม่เมื่อเปลี่ยนวัน | Example 2: Hide Repeated Tasks, Show Again on a New Day

THงานหลักหนึ่งงานมีงานย่อยหลายแถว เราอยากซ่อนชื่องานที่ซ้ำ

แต่ถ้าขึ้นวันใหม่ ชื่องานควรกลับมาแสดง ถึงจะเป็นงานเดิมก็ตาม

ถ้าใช้แค่ =B2=B1 ชื่องานจะหายข้ามวัน ดูแถว 5 ในตารางนี้

ENOne main task can have many subtask rows. We want to hide the repeats.

But on a new day, the task name should show again, even if it's the same task.

With only =B2=B1, the name stays hidden across days. See row 5 below.

แถวRowA วันที่DateB งานหลักMain Task=B2=B1=AND($A2=$A1,B2=B1)
201/03T0001 | ปรับปรุงเว็บไซต์แสดง Showแสดง Show
301/03T0001 | ปรับปรุงเว็บไซต์ซ่อน Hideซ่อน Hide
401/03T0002 | รายงานประจำเดือนแสดง Showแสดง Show
502/03T0002 | รายงานประจำเดือน❌ ซ่อน Hide✅ แสดง Show
602/03T0003 | อบรมพนักงานใหม่แสดง Showแสดง Show

ขั้นตอน | Steps

#ภาษาไทยEnglish
1เรียงตาม วันที่ แล้วตาม งานหลักSort by Date, then Main Task
2ลากเลือก B2:B20 โดยเริ่มที่ B2Select B2:B20, starting at B2
3New Rule → Use a formula…New Rule → Use a formula…
4ใส่สูตร =AND(B2<>"",$A2=$A1,B2=B1)Enter =AND(B2<>"",$A2=$A1,B2=B1)
5Format → Number → Custom → ;;; → OK → OKFormat → Number → Custom → ;;; → OK → OK
ขั้นตอนที่ 4: สูตร | Step 4: formula=AND(B2<>"",$A2=$A1,B2=B1)
ขั้นตอนที่ 5: Custom number format | Step 5: custom number format;;;

TH$A คือล็อกให้เช็กวันที่จากคอลัมน์ A เสมอ

EN$A locks the check to the Date column (column A).

THถึงวันที่ในคอลัมน์ A จะถูกซ่อนไปแล้ว สูตรก็ยังอ่านค่าได้ เพราะ ;;; แค่ซ่อนการแสดงผล ค่าจริงยังอยู่

ENEven if the dates in column A are hidden, the formula still reads them. ;;; only hides the display. The value stays.

6. ข้อควรระวัง | Watch Out

#ภาษาไทยEnglish
1ต้องเรียงข้อมูลก่อน สูตรเทียบกับแถวบนแถวเดียว ถ้าค่าซ้ำอยู่ห่างกัน จะไม่ถูกซ่อนSort first. The rule only checks the row above. Repeats that are far apart won't hide.
2สูตรต้องอ้างแถวบนของแถวแรกที่เลือก เลือกจาก A2 ต้องเขียน A2=A1 ถ้าเขียนผิดแถว จะซ่อนผิดเซลล์Point to the row above your first row. Start at A2 → write A2=A1. The wrong row hides the wrong cells.
3ข้อมูลยังอยู่ครบ SUM, COUNT, XLOOKUP, Sort, Filter ใช้ได้ปกติThe data is still there. SUM, COUNT, XLOOKUP, Sort and Filter work as normal.
4ตอนกรอง (Filter) สูตรยังเทียบกับแถวบนที่ถูกกรองซ่อนไป แถวแรกที่เห็นอาจดูว่างWhen filtering, the rule still checks the hidden row above. The first visible row may look empty.
5คนอื่นอาจไม่รู้ว่ามีข้อมูลซ่อนอยู่ เขียนหมายเหตุไว้ข้างตารางOthers may not know data is hidden. Add a short note next to the table.
6ถ้าใช้ Table กฎจะขยายเองเมื่อเพิ่มแถว แต่การ copy/paste ทับอาจทำให้กฎแตกเป็นหลายชิ้น ให้เช็กที่ Manage RulesIn a Table, the rule grows with new rows. Pasting over cells can split it. Check Manage Rules.
7ฟีเจอร์นี้มีใน Excel บน Windows มานานแล้ว ถ้าใช้ Excel บนเว็บหรือ Mac ให้ลองก่อนThis works in Excel for Windows. On Excel for the web or Mac, test it first.

7. เอาไปใช้ต่อได้อีก | More Ideas

ไอเดีย Ideaสูตร Formula (เริ่มแถว 2 · start at row 2)
ซ่อนชื่อลูกค้าที่ซ้ำHide repeated customer names=AND(B2<>"",B2=B1)
ซ่อนเลขใบสั่งซื้อที่ซ้ำHide repeated order numbers=AND(C2<>"",C2=C1)
ซ่อนเลข 0 เฉพาะแถวที่ยกเลิกHide zeros on cancelled rows=AND($D2="4.ยกเลิก",E2=0)
ซ่อนตัวเลขทั้งแถวที่ยกเลิกHide all numbers on cancelled rows=$D2="4.ยกเลิก"(เลือกทั้งแถว · select whole rows)
ซ่อนหมวดหมู่ย่อยที่ซ้ำHide repeated sub-categories=AND($A2=$A1,B2=B1)

💡 แตะที่สูตรเพื่อคัดลอก | Tap a formula to copy it.

THทุกไอเดียใช้หลักเดียวกัน สูตรบอกว่า "ซ่อนเมื่อไหร่" แล้วให้ ;;; เป็นตัวซ่อน

ENSame idea every time: the formula says when to hide, and ;;; does the hiding.

8. ไฟล์ตัวอย่าง | Sample File

THไฟล์มี 3 ชีต ข้อมูลทั้งหมดเป็นข้อมูลสมมติ ทุกชีตเป็น Table แบบแถวสลับสี และแถวที่สถานะ "1.ค้าง Pending" ไฮไลต์สีเหลือง เพื่อให้เห็นว่าวิธีนี้ใช้ได้บนพื้นสีจริง

  • 01_Before – ข้อมูลดิบ ยังไม่ซ่อน ไว้ฝึกทำตาม
  • 02_Dates – ตัวอย่างที่ 1: ซ่อนวันที่ซ้ำ
  • 03_MainTasks – ตัวอย่างที่ 2: ซ่อนวันที่ซ้ำ + ซ่อนชื่องานซ้ำในวันเดียวกัน

ENThe file has 3 sheets with fictional data. Each sheet is a Table with banded rows. Rows with status "1.ค้าง Pending" are highlighted yellow, so you can see the trick works on coloured rows.

  • 01_Before – raw data, nothing hidden, for practice
  • 02_Dates – Example 1: hide repeated dates
  • 03_MainTasks – Example 2: hide repeated dates + repeated tasks within the same day
📥 ดาวน์โหลด | Download: hide-repeated-values.xlsx

สรุปสั้นๆ | Quick Recap

THสูตร =AND(A2<>"",A2=A1) + Format → Number → Custom → ;;;

= ซ่อนค่าซ้ำ เหลือตัวแรก ใช้ได้บนพื้นทุกสี

ENFormula =AND(A2<>"",A2=A1) + Format → Number → Custom → ;;;

= hide repeats, keep the first, works on any background.

#Excel #ทริคExcel #ConditionalFormatting #สอนExcel #ExcelTips