Excel မှာ Name တူတာတွေကို Color နဲ့ ပြဖို့ အဓိကနည်းလမ်း (၃) မျိုး။ 👇
1️⃣. Conditional Formatting သုံးပြီး အလိုအလျောက် Color ချပေးနည်း။
🔶အဆင့်ဆင့် လုပ်ဆောင်ချက်:
1. Data range ကို Select လုပ်ပါ။
- Name တွေရှိတဲ့ Column ကို Select လုပ်ပါ။
2. Conditional Formatting ကိုသွားပါ။
- Home Tab > Conditional Formatting > New Rule
3. Rule Type ရွေးပါ။
- "Use a formula to determine which cells to format" ကိုရွေးပါ။
4. Formula ရိုက်ထည့်ပါ။
=COUNTIF($A:$A,$A1)>1
- A က Name Column ဖြစ်ပါတယ်
- ကိုယ့် Data နဲ့ ကိုက်ညီအောင် Column Letter ပြောင်းနိုင်ပါတယ်။
5. Format ချိန်းပါ။
- Format Button ကိုနှိပ်ပါ✔️
- Fill Tab ကနေ Color ရွေးပါ✔️
- OK နှိပ်ပါ✔️
2️⃣. Duplicate Values အတွက် Built-in Option သုံးနည်း။
1. Data range Select လုပ်ပါ။
2. Home Tab > Conditional Formatting > Highlight Cells Rules > Duplicate Values
3. Duplicate Values Dialog Box ပေါ်လာရင်
- "Duplicate" ကိုရွေးပါ✔️
- Color ရွေးပါ✔️
- OK နှိပ်ပါ✔️
3️⃣. VBA Code သုံးနည်း (Advanced)
Sub HighlightDuplicateNames()
Dim rng As Range
Dim cell As Range
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary"
Set rng = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
For Each cell In rng
If dict.exists(cell.Value) Then
cell.Interior.Color = RGB(255, 255, ' Yellow color
Else
dict.Add cell.Value, 1
End If
Next cell
End Sub
📌VBA သုံးမယ်ဆိုရင်:
- Alt + F11 နှိပ်ပါ✔️
- Insert > Module လုပ်ပါ✔️
- Code ကို Copy-Paste လုပ်ပါ✔️
- F5 နှိပ်ပြီး Run ပါ✔️
⚠️သတိထားရန်:
- Case Sensitivity : Excel က Default အားဖြင့် Case Sensitive မဟုတ်ပါ ("John" နဲ့ "JOHN" က တူတယ်လို့မှတ်ယူပါတယ်)
- ချွင်းချက်ချင်ရင် : First Occurrence ကိုမချွင်းချင်ရင် `>=1` အစား `>1` သုံးပါ။
- Multiple Columns : နေရာတိုင်းမှာ ချချင်ရင် Data Range ကိုကျယ်ကျယ်ရွေးပါ။
🧠အကြံပြုချက်: ပုံမှန်အားဖြင့် Conditional Formatting နည်းလမ်း (၁) က အသုံးအများဆုံးနဲ့ အလွယ်ကူဆုံးဖြစ်ပါတယ်။
𝑪𝒐𝒎𝒑𝒖𝒕𝒆𝒓 𝑶𝒏𝒍𝒊𝒏𝒆 𝑻𝒓𝒂𝒊𝒏𝒊𝒏𝒈

image