Highlight entire row in certain color if cell value = Smith

Good afternoon,

I am working on an extensive historical timeline involving 7 different fire departments. To make finding the information easier I want to have an entire rows fill color turn blue when the word "Smith"(the name of one of the fire departments) is entered in a specific cell in that row. I will have a different color for each fire department.


Is this possible and if so, how is it accomplished?


Thanks in advance and regards,


Andrew

MacBook Pro with Retina display, OS X Mavericks (10.9.3)

Posted on Jun 25, 2015 2:23 PM

Reply
3 replies

Jun 25, 2015 6:27 PM in response to Firecop1

Hi Firecop,


SG's applescript that Ian directed you to is the best way to do what you are asking for.


Another approach might be to create your tables with an Index column that would make it easy to bring the different firehouses into their own summary tables. If this sounds like something you would like to do, post a screenshot of part of your table and we would be glad to help you set that up.


quinn

Jun 25, 2015 6:59 PM in response to Firecop1

Below is the script, slightly modified to make it easier to look for "Smith" (or whatever).


Again, three easy steps:


  1. Copy and paste into AppleScript Editor
  2. Click once anywhere in the table (to tell the script what table you mean)
  3. Click the green triangle 'Run' button.


(Change color, column, and search-for value as desired in properties.)


SG



property startRow : 2 -- to skip a header row

property columnToTest : 3 --column C, change as needed, 2 for B, 4 for D, etc.

property valueToTestFor : "Smith"

property highlightColor : "red"

tell application "Numbers"

try

set t to front document's active sheet's first table whose selection range's class is range

tell t to repeat with r from startRow to row count

set v to row r's cells's value

if v'sitemcolumnToTest contains valueToTestFor then

set rowr'sbackground color to highlightColor

end if

end repeat

end try

end tell

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Highlight entire row in certain color if cell value = Smith

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