Excel has no built-in PAN validator, but you can build one in a few minutes with a formula that checks total length, letter and digit positions, and the PAN format rules. A PAN (Permanent Account Number) is always ten characters: five letters, then four digits, then one letter. The first three letters are alphabetic series, the fourth letter shows the holder type (P for individual, C for company, H for HUF, F for firm, A for association of persons, T for trust, B for body of individuals, L for local authority, J for artificial juridical person, G for government), the fifth letter is the first letter of the surname or entity name, the next four characters are digits, and the last character is a letter. A formula that enforces this pattern will catch typos, extra spaces and pasted text before they reach your records.

What You'll Need

  • A recent version of Excel (Microsoft 365, Excel 2021, 2019 or later) on Windows, Mac or the web app. Older versions lack some of the functions used below, so the alternate formula is given too.
  • Your list of PAN numbers in a single column, one per cell, with no other text in the same cell.
  • Excel's calculation mode set to Automatic (Formulas tab > Calculation Options), otherwise the results will not refresh.
  • Optional: a helper column for cleaning the data before validation, which makes mistakes easier to trace.

Step-by-Step

  1. Put each PAN in its own cell, for example from A2 downwards, and leave A1 for a header such as "PAN". Mixed case is fine because the formula converts text to uppercase before testing.
  2. Create a cleanup column in B. In B2 enter =UPPER(TRIM(SUBSTITUTE(A2,CHAR(160)," "))). This removes leading and trailing spaces, converts non-breaking spaces that arrive from web pages or PDFs into ordinary spaces, and uppercases everything. Drag it down the column. Cleaning first stops invisible characters from failing an otherwise correct PAN.
  3. In C2, enter the main validation formula using modern Excel: =AND(LEN(B2)=10,ISTEXT(B2),AND(ISNUMBER(--MID(B2,ROW(INDIRECT("1:10")),1))=FALSE),ISNUMBER(--MID(B2,4,1))=TRUE,ISNUMBER(--MID(B2,5,1))=TRUE,ISNUMBER(--MID(B2,6,1))=TRUE,ISNUMBER(--MID(B2,7,1))=TRUE,ISNUMBER(--MID(B2,8,1))=TRUE,ISNUMBER(--MID(B2,9,1))=TRUE,NOT(ISNUMBER(--LEFT(B2,1))),NOT(ISNUMBER(--MID(B2,10,1)))). That is hard to read, so use the simpler and more reliable version below.
  4. Instead, build the check as a pattern test. In C2 enter =AND(LEN(B2)=10,SUMPRODUCT(--ISNUMBER(--MID(B2,{1;2;3;4;5;6;7;8;9;10},1)))=0,SUMPRODUCT(--ISNUMBER(--MID(B2,{1;2;3;4;5},1)))=0,SUMPRODUCT(--ISNUMBER(--MID(B2,{4;5;6;7;8;9},1)))=4). The first part fixes the length, the second rejects digits in the first five positions, and the third requires all six middle-to-late positions (fourth through ninth characters) to be digits. Combined with a ten-character length, this forces letters in positions 1 to 3, digits in 4 to 9, and a letter in position 10, because a ten-character string with letters in the first five positions and digits in six positions cannot have a digit in the last position.
  5. For older Excel versions or if the array constants misbehave, use the explicit stacked test: =AND(LEN(B2)=10,NOT(ISNUMBER(--MID(B2,1,1))),NOT(ISNUMBER(--MID(B2,2,1))),NOT(ISNUMBER(--MID(B2,3,1))),NOT(ISNUMBER(--MID(B2,4,1))),NOT(ISNUMBER(--MID(B2,5,1))),ISNUMBER(--MID(B2,6,1)),ISNUMBER(--MID(B2,7,1)),ISNUMBER(--MID(B2,8,1)),ISNUMBER(--MID(B2,9,1)),NOT(ISNUMBER(--MID(B2,10,1)))). Note the position numbers: the fourth character is a letter showing holder type, so the digits start at the sixth character of the cleaned string only if the fourth and fifth are letters. Adjust the range if your format reading differs.
  6. Simplify by validating against the documented layout directly. Use =AND(LEN(B2)=10,SUMPRODUCT(--ISNUMBER(--MID(B2,ROW(INDIRECT("1:5")),1)))=0,SUMPRODUCT(--ISNUMBER(--MID(B2,ROW(INDIRECT("6:9")),1)))=4,NOT(ISNUMBER(--MID(B2,10,1)))). Here positions 1 to 5 must be non-numeric, positions 6 to 9 must be numeric, and position 10 must be non-numeric. This matches the standard layout where five letters precede four digits, followed by a final letter.
  7. Wrap the result in a friendly message so the sheet reads clearly. In D2 enter =IF(C2,"Valid format","Check this PAN") and drag down. Conditional formatting (Home > Conditional Formatting > New Rule > Format only cells that contain) can colour the invalid rows red.
  8. Filter on the friendly column to list every failing row, then correct those entries by hand. Re-check that cleaned values were what you intended to store, and keep the original column until you are satisfied.
  9. If you need the holder-type check, add a lookup: =IFERROR(ISNUMBER(SEARCH(MID(B2,4,1),"PCHFATBLJG")),FALSE) and combine it with the pattern test using AND. This only confirms the fourth letter is a recognised type code, not that it matches the holder.

If that did not work, check the obvious causes first. Blank cells and numbers-only cells often fail because Excel silently stores a PAN as a number if it is all digits, so format the column as Text and re-enter the value. Trailing spaces pasted from another system survive TRIM only if they are normal spaces, which is why the SUBSTITUTE step matters. If the whole column shows #VALUE!, a cell probably contains an error or an empty string; wrap the formula region in IFERROR to keep the sheet usable.

Common Mistakes

  • Trusting a format check as proof of authenticity. Any correctly shaped string passes; only the Income Tax Department's verification facility can confirm a PAN actually exists and belongs to the stated holder.
  • Forgetting to clean the data first, so invisible characters or lowercase letters cause false failures.
  • Storing PANs in a general-format column, letting Excel convert them or strip leading zeros in related data.
  • Assuming the fourth character check covers the fifth; both are letters in the standard layout and both are part of the pattern.
  • Sharing workbooks containing real PANs freely; these are personal identifiers and should be handled carefully.

Tips

  • Use Data > Data Validation with a Custom formula pointing at the cleaned column so new entries are blocked at input time rather than checked afterwards.
  • Keep a separate sheet for the cleaning and checking formulas so the original data stays untouched.
  • Name the result column something clear such as "PAN format OK" and freeze the header row for long lists.
  • Test your formula with a known-good sample and a few deliberately broken ones (nine characters, a digit in the first position, a trailing space) before rolling it out.

Troubleshooting

  • Every row fails: check calculation mode is Automatic and that the range in INDIRECT or MID matches the column you are actually testing.
  • Correct PANs fail: run the cleanup column and look at the exact characters with LEN and CODE to spot hidden spaces or non-breaking characters.
  • Formulas show as text: the cell may be formatted as Text; set it to General and re-enter the formula.
  • Older Excel rejects the array formula: use the stacked explicit version from step 5, or enter the array formula with Ctrl+Shift+Enter.
  • Results do not update after correction: press F9 to recalculate, or check that the dependent cells reference the cleaned column, not the original.

Frequently Asked Questions

Does Excel have a built-in PAN validator?

No. You must build a formula or use Data Validation with a custom rule. There is no function that knows PAN rules.

Can a formula confirm a PAN is genuine?

No. It can only confirm the format. Genuine verification requires the official Income Tax Department facility, which is outside Excel.

Why does my ten-character PAN fail the test?

Most often a hidden space, a lowercase letter, or a digit sitting where a letter should be. Clean the cell first and compare each position.

Can I use Data Validation instead of a formula column?

Yes. Select the column, open Data > Data Validation, choose Custom, and paste the validation formula with the cell reference adjusted to the first cell of the range.

Is it safe to keep PANs in an Excel file?

Treat the file as sensitive personal data: limit who can open or share it, avoid emailing it unencrypted, and do not store it longer than needed.