Extract an ICD-10 Code from Text and Look It Up in Excel
Question details
Extract an ICD-10 code from a text description and return its definition from another worksheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Descriptions may contain separators or multilingual text, while codes and definitions are stored on a separate ACSC worksheet.
- Observed behavior
- The desired result is the definition corresponding to the code found in each description.
Place the descriptions in column A of your working sheet and the lookup codes and definitions in columns A and B of the ACSC sheet. Store lookup codes as text and check that their decimal notation matches the descriptions.
Extract a code with REGEXEXTRACT and look it up with XLOOKUP
Use this method when your Excel version supports REGEXEXTRACT and XLOOKUP.
The pattern finds the first code-shaped sequence with a letter, a digit, a letter or digit, and an optional decimal followed by up to four letters or digits. Separators and non-Latin text can surround the code, but a code directly attached to another ASCII letter or digit will not be extracted.
A pattern match is not proof that a code is valid. If a description contains multiple code-shaped sequences, the formula checks only the first one against the lookup sheet.
On the working sheet, enter this formula in B2: =IFERROR(REGEXEXTRACT(A2,"(?i)(?<![A-Z0-9])[A-Z][0-9][A-Z0-9](?:\.[A-Z0-9]{1,4})?(?![A-Z0-9]|\.[A-Z0-9])"),"")
In C2, enter =IF(B2="","Not found",XLOOKUP(B2,ACSC!A:A,ACSC!B:B,"Not found")) to return the matching definition.
Select B2:C2 and drag the fill handle down alongside the descriptions. Review any blank extractions or results marked Not found.

Find the longest matching lookup code with helper cells
Use this approach in Excel when regex functions are unavailable and you have a list of possible codes.
Look up ICD-10 definitions in WPS Spreadsheets
Use a helper column in WPS Spreadsheets to search a description for codes from your lookup list and return the definition of the longest match.
- 1. Open the workbook: Open the workbook in WPS Spreadsheets. Put the description in Sheet1!A2 and the codes and definitions in ACSC columns A and B.
- 2. Create the helper column: In ACSC!C2, enter =IF(A2="","",IF(ISNUMBER(SEARCH(A2,Sheet1!$A$2)),LEN(A2),0)) and fill the formula down through C1000.
- 3. Return the definition: In Sheet1!B2, enter =IF(MAX(ACSC!$C$2:$C$1000)=0,"Not found",INDEX(ACSC!$B$2:$B$1000,MATCH(MAX(ACSC!$C$2:$C$1000),ACSC!$C$2:$C$1000,0))). Adjust the ranges if your lookup list has a different length.
- 4. Verify the result: Compare B2 with the text in A2. This substring method can match text inside a longer word or code, and equally long matches return the first lookup-list entry.

Frequently Asked Questions
Why does the Excel formula return Not found?
Check the extracted value in B2 against the text codes in ACSC column A. The code may be missing from the lookup list, use different decimal notation, or not have been extracted.
Can the regex formula find a code next to multilingual text?
Yes. The pattern can find a code next to non-Latin characters or separators, but it requires a boundary before and after the code where adjacent ASCII letters and digits are concerned.
What happens if a description contains more than one code?
The REGEXEXTRACT formula returns the first code-shaped sequence only. The helper-column method returns the longest lookup-list match, or the first listed match when lengths are equal. Review descriptions with multiple codes.
Does a pattern match confirm that an ICD-10 code is valid?
No. A text sequence can resemble a code without being valid. Check the extracted value against your current, authoritative code list and the relevant coding rules.




