Function Problems

Return Cell Text and Color with INDEX and MATCH in Excel

Kushani NimanthikaKushani Nimanthika Nov 18, 2026 871 views

Question details

Return matching cell text and reproduce or copy its fill and font colors.

Return Cell Text and Color with INDEX and MATCH in Excel
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.
Before you start

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.

Solution 1Recommended

Recreate the color with conditional formatting

Use this approach when the desired color can be determined from the returned text or another value.

1
Return the matching text

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.

2
Create a formatting rule

Select E2, then choose Home > Conditional Formatting > New Rule. Select a rule that formats cells containing a specific value or text.

3
Set the matching color

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.

Recreate the color with conditional formatting
How the color is determined: The rule recreates a color from the result; it does not read the formatting of the source cell.
Work with lookup results in WPS

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. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 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. 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. 4. Save the workbook: Use File > Save As to save the workbook in an Excel format such as XLSX.
Recreate fill or font colors for lookup results using conditional formattingOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and formatting tools
microsoft office alternative - wps office

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.