Numbers: Change cell color based on text in another cell

I am not sure if this possible, but I will ask anyway. There might be agar who can help.


In mac numbers, I want a specific cell to change colour based on what TEXT is in a different cell?

I am trying go get Column C at C9 and C10 to be the same background colour as A2/B2/D9 (yellow) but the colour of that cell is dependant on the dropdown of D9, D10 etc as they could be any of the 4 riders. So in an ideal world when D9 is elected as Rider 1, this will populate C9 with Dave and colour its background as yellow and colour E9 background as yellow but allow me to enter a number (miles) into E9.


Formula I'm using in C9 is..... IF(D9="Rider 4",$B$5, IF(D9="Rider 3",$B$4, IF(D9="Rider 2",$B$3,IF(D9="Rider 1",$B$2, IF(D9="","")))))


Please get back to me if you need further clarification.


thanks in advance.

Posted on Sep 15, 2026 7:27 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 15, 2026 10:41 AM

First, change the formula in cell C9 to:


=XLOOKUP(D9,A,B,"",0)


This is a much more concise and reliable way of finding the rider's name - it looks in the adjacent cell D9 to find the 'Rider x' value and looks that up in Column A. When it finds a result it returns the corresponding value from column B.


In this way it's performing a dynamic lookup - if you ever added a 'Rider 5', you'd have to update every cell in your original formula to have an IF(D9="Rider 5"...) clause, but with this XLOOKUP it's dynamic and automatic.


That said, the simplest solution to your ask is via Conditional Formatting (Inspector -> Cell -> Conditional Highlighting.


There are two elements to Conditional Formatting you might be missing - first is that you can have any number of conditions to check, the second is how you get it to look at a dynamic value rather than a static one.


In this case, I set a series of rules on cell C9 that look like:



The trick is getting it to reference cells in column B. To do this, you need to click the little green icon that appears at the right hand end of the value field:



This lets you click on another cell in the table to use as a reference (otherwise typing in, say, 'B2' would look for the literal string "B2" rather than the contents of cell B2). Just make sure you click the green check mark to save the change (hitting return/enter won't do it):



Then click on the cell reference and turn on Preserve Row and Preserve Column, so that it always references these exact cells.


So now you can select from the popup menu in column D to select a rider number. That will initiate a XLOOKUP in column C to find the rider's name, which in turn will trigger the Conditional Highlighting to choose the appropriate color,


Optional: One other change I would make is to put the Rider number/names into a separate table. The XLOOKUP() will still work the same, but it helps to separate out the different classes of data (one table for the riders, another table for the Run):



This has the slight speed benefit - since the XLOOKUP() only has to scan column A in the smaller Riders table, and it's also easier to add new riders without having to shuffle the runs around, inserting additional rows, etc.


Having everything in a single table is the Excel-ish way of doing things (although even Excel now offers to separate tables within a sheet, but not in quite such an elegant manner as Numbers does)

1 reply
Question marked as Top-ranking reply

Sep 15, 2026 10:41 AM in response to alig31

First, change the formula in cell C9 to:


=XLOOKUP(D9,A,B,"",0)


This is a much more concise and reliable way of finding the rider's name - it looks in the adjacent cell D9 to find the 'Rider x' value and looks that up in Column A. When it finds a result it returns the corresponding value from column B.


In this way it's performing a dynamic lookup - if you ever added a 'Rider 5', you'd have to update every cell in your original formula to have an IF(D9="Rider 5"...) clause, but with this XLOOKUP it's dynamic and automatic.


That said, the simplest solution to your ask is via Conditional Formatting (Inspector -> Cell -> Conditional Highlighting.


There are two elements to Conditional Formatting you might be missing - first is that you can have any number of conditions to check, the second is how you get it to look at a dynamic value rather than a static one.


In this case, I set a series of rules on cell C9 that look like:



The trick is getting it to reference cells in column B. To do this, you need to click the little green icon that appears at the right hand end of the value field:



This lets you click on another cell in the table to use as a reference (otherwise typing in, say, 'B2' would look for the literal string "B2" rather than the contents of cell B2). Just make sure you click the green check mark to save the change (hitting return/enter won't do it):



Then click on the cell reference and turn on Preserve Row and Preserve Column, so that it always references these exact cells.


So now you can select from the popup menu in column D to select a rider number. That will initiate a XLOOKUP in column C to find the rider's name, which in turn will trigger the Conditional Highlighting to choose the appropriate color,


Optional: One other change I would make is to put the Rider number/names into a separate table. The XLOOKUP() will still work the same, but it helps to separate out the different classes of data (one table for the riders, another table for the Run):



This has the slight speed benefit - since the XLOOKUP() only has to scan column A in the smaller Riders table, and it's also easier to add new riders without having to shuffle the runs around, inserting additional rows, etc.


Having everything in a single table is the Excel-ish way of doing things (although even Excel now offers to separate tables within a sheet, but not in quite such an elegant manner as Numbers does)

Numbers: Change cell color based on text in another cell

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.