I continued to play with Numbers and the lookup task.
So, you were mistaken about values NOT being found in more than one table during the lookup...
That's weird – I thought I tested and confirmed your conclusion.
Oh, well. I've been doing too many things at once lately.
At the moment I need to find a single hit in a given worksheet, but at some point I'll need to manage a multiple-hit condition – so something like this will work.
-------------------------------------------------------------------------------------------
set lookupValue to "125"
set lookupFoundCellList to {}
tell application "Numbers"
tell document "Test.numbers"
tell active sheet
tell tables
set lookupFoundList to cells where its formatted value is lookupValue
end tell
end tell
end tell
# Reduce list-of-lists to a single list – I could discern the table number here if needed.
repeat with ndx1 in lookupFoundList
repeat with ndx2 in ndx1
set end of lookupFoundCellList to contents of ndx2
end repeat
end repeat
# return lookupFoundCellList
if length of lookupFoundCellList = 1 then
set firstLookupHit to item 1 of lookupFoundCellList
else
error "More than one hits were found for the given lookup value"
end if
end tell
-------------------------------------------------------------------------------------------