Return Cell Text and Color with INDEX and MATCH in Excel
Question details
Return matching cell text and reproduce or copy its fill and font colors.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants an INDEX and MATCH lookup result to show both the text and formatting color of the matching cell.
- Observed behavior
- INDEX and MATCH return cell values, but do not return fill or font formatting.
Identify the lookup column, the cells containing the text and colors, and the output cell. Check whether the colors follow rules based on the text or are applied individually.
Recreate the color with conditional formatting
Use this approach when the desired color can be determined from the returned text or another value.
For example, with lookup keys in A2:A100, text in B2:B100, and the lookup value in D2, enter =INDEX(B2:B100,MATCH(D2,A2:A100,0)) in E2.
Select E2, then choose Home > Conditional Formatting > New Rule. Select a rule that formats cells containing a specific value or text.
Enter the value or text to match, select Format, and choose the corresponding fill or font color. Confirm the rule and repeat for other values and colors.

Copy the matching cell's stored colors with VBA
Use a macro in desktop Excel when colors are applied individually and must be copied from the source cell.
Recreate Lookup Result Colors in WPS Spreadsheets
Use INDEX and MATCH to return text in WPS Spreadsheets, then apply conditional formatting rules to recreate colors based on the returned value.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
- 2. Enter the lookup formula: With keys in A2:A100, text in B2:B100, and the lookup value in D2, enter =INDEX(B2:B100,MATCH(D2,A2:A100,0)) in E2.
- 3. Add color rules: Select E2 and choose Home > Conditional Formatting. Create rules for the returned values and set the desired fill or font colors.
- 4. Save the workbook: Use File > Save As to save the workbook in an Excel format such as XLSX.

Frequently Asked Questions
Can INDEX and MATCH return a cell's fill color?
No. INDEX and MATCH return a value, not the source cell's formatting. Use conditional formatting to recreate a rule-based color or VBA to read the stored color.
Can I return the font color instead of the fill color?
Yes, a VBA macro can read the source cell's Font.Color and assign it to the output cell. For rule-based colors, set the font color under Home > Conditional Formatting.
Will the VBA macro update when I change a source color?
No. The example macro copies the current text and stored colors when you run it. Run it again through Developer > Macros after changing the lookup value or source formatting.
Does the macro copy colors shown by conditional formatting?
The example reads Interior.Color and Font.Color, which represent stored formatting rather than the displayed conditional-formatting result. Recreate the same conditional formatting rules on the output cell when possible.




