Numbers.app – Finding Values in a Table

  1. If you wanted to search for a Column containing name X what would you use?

  2. To search the column containing name X but searching on the same row as the currently selected Row?

Something like this for item 1:

In this one I'm just finding the first instance of the search string in the current table...

--------------------------------------------------------
# Auth: Christopher Stone <scriptmeister@thestoneforge.com>
# dCre: 2023/05/01 02:31
# dMod: 2023/05/01 02:31 
# Appl: Numbers
# Task: Find a Cell in the Current Table Whose Value Contains the Search String.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Numbers, @Find, @Cell, @Value, @Contains, @Search @String
--------------------------------------------------------

set searchValue to "Nirvana"

tell application "Numbers"
   tell front document
      tell active sheet
         tell front table
            set foundCellList to cells where its value contains searchValue
            if length of foundCellList > 0 then
               set selection range to item 1 of foundCellList
            end if
         end tell
      end tell
   end tell
end tell

--------------------------------------------------------

Something like this for item 2:

--------------------------------------------------------
# Auth: Christopher Stone <scriptmeister@thestoneforge.com>
# dCre: 2023/05/01 02:18
# dMod: 2023/05/01 02:18 
# Appl: Numbers
# Task: Search the Current Row for the Given Search Value.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Numbers, @Search, @Current, @Row, @Search, @Value
--------------------------------------------------------

set searchValue to "Nirvana"

tell application "Numbers"
   tell front document
      tell active sheet
         tell front table
            set currentCell to first cell of selection range
            set searchRow to row of currentCell
            set foundCellList to cells of searchRow whose value contains searchValue
            if length of foundCellList > 0 then
               set selection range to item 1 of foundCellList
            end if
         end tell
      end tell
   end tell
end tell

--------------------------------------------------------