• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Numbers – Look-Up a Value in a Worksheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Numbers – Look-Up a Value in a Worksheet


  • Subject: Re: Numbers – Look-Up a Value in a Worksheet
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 11 Feb 2017 20:41:17 -0600

On Feb 11, 2017, at 04:56, Yvan KOENIG <email@hidden> wrote:
I continued to play with Numbers and the lookup task.


Hey Yvan,

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

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

--
Take Care,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Numbers – Look-Up a Value in a Worksheet
      • From: Christopher Stone <email@hidden>
References: 
 >Numbers – Look-Up a Value in a Worksheet (From: Christopher Stone <email@hidden>)
 >Re: Numbers – Look-Up a Value in a Worksheet (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Numbers – Look-Up a Value in a Worksheet
  • Next by Date: Re: Need to run script periodically
  • Previous by thread: Re: Numbers – Look-Up a Value in a Worksheet
  • Next by thread: Re: Numbers – Look-Up a Value in a Worksheet
  • Index(es):
    • Date
    • Thread