Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Really need some Numbers 09 Applescript help please.

Hi All,


I am attempting to use Applescript to allow me to collect the values of a pair of columns on one table and store them in an array then to use the values of one of those columns and compare them to the values of a column in another table and populate the coresponding second column of that other table with the second column stored in the array from the first table by comparing their coresponding matching values in the first column.


That was a real mouthful so to de-confuse you here is an example :-)



Table 1:

Name | Age | Skill | Diet

Fred | 35 | Programmer

Jane | 40 | Analyst

Andy | 20 | Slob

Peter | 22 | Gardener


Table 2

Name | Diet

Fred | Vegetarian

Eddy | Meat Eater

Boris | Vegetarian

Peter | Pescetarian


In this case I would need the script to add the Diet column values from table 2 to the Diet column in table 1 when I get a match in the Name columns of both tables (for Fred and Peter in this case) So it's kind of merging data between two tables.


To give you this:


Table 1 (Updated)

Name | Age | Skill | Diet

Fred | 35 | Programmer | Vegetarian

Jane | 40 | Analyst |

Andy | 20 | Slob |

Peter | 22 | Gardener | Pescetarian



I'm very new to Applescript so this is giving me total grief.


Any ideas please anyone as I am at the end of my tether and have wasted hours trying to figure out where to start even:-(


Cheers in advance


Paul :-)

Posted on Nov 5, 2011 8:03 AM

Reply
Question marked as Best reply

Posted on Nov 5, 2011 8:26 AM

Hi Paul,


This isn't an AppleScript solution, but does the job with a formula. You'll notice that I've changed the order of the names in the second table to check that the formula is independent of the order.


User uploaded file

Formula in Table 1::D2, and filled dow the rest of column D:


=IFERROR(OFFSET(Table 2 :: $A$1,MATCH(A,Table 2 :: $A,0)-1,1),"")


The zero argument in MATCH displays as "Find value" in the formula box, and specifies that MATCH is to match only the actual search value.


Descriptions of the functions used and further examples can be found in the iWork Formulas and Functions User Guide. You can download the guide via the Help menu in Numbers.


Regards,

Barry

4 replies
Question marked as Best reply

Nov 5, 2011 8:26 AM in response to Paul Randall

Hi Paul,


This isn't an AppleScript solution, but does the job with a formula. You'll notice that I've changed the order of the names in the second table to check that the formula is independent of the order.


User uploaded file

Formula in Table 1::D2, and filled dow the rest of column D:


=IFERROR(OFFSET(Table 2 :: $A$1,MATCH(A,Table 2 :: $A,0)-1,1),"")


The zero argument in MATCH displays as "Find value" in the formula box, and specifies that MATCH is to match only the actual search value.


Descriptions of the functions used and further examples can be found in the iWork Formulas and Functions User Guide. You can download the guide via the Help menu in Numbers.


Regards,

Barry

Nov 5, 2011 8:43 AM in response to Barry

Hi Barry and thanks for your quick response.


I really thought that I would have to resort to Applescript for this as the data in my Name columns for each table are in a different order and one table has missing values it's Name column. And as I am a complete dullard with Spreadsheets I looked completely at the wrong type of solution.


Thanks ever so much.


I will see if I can impliment your soluton right now and report back hopefully with a smile :-)


Cheers


Paul

Really need some Numbers 09 Applescript help please.

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