AppleScript的比较单元格的值,然后一个单元格的值放到另一个 [英] applescript to compare cell values and then place the value of one cell into another

查看:300
本文介绍了AppleScript的比较单元格的值,然后一个单元格的值放到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个数字的应用程序表,我有以下数据

  A B C D
USER_ID登录USER_ID登录
2039雅培,瑞秋亚当斯,苏
110雅培,谢尔比亚当森,温迪
2910亚伯拉罕,BINU安德森,达里尔
121亚当斯,苏
122亚当森,安妮
126亚当森,温迪

我想写一个AppleScript即会...


  1. 迭代倒在D列
  2. 登录
  3. 要查找B列匹配的登录名

  4. 在走行中A列的user_id的值,其中找到匹配

  5. ,并将其放置到塔C在同一行作为列中的条目D


 设置DNAME为correlationstudies.numbers
设置SNAME为用户
设置TNAME表1
设置login_row 2
设置login_w_id_row 2告诉应用程序号码告诉文档DNAME告诉板材SNAME告诉表TNAME
   重复
      设置登录列4细胞login_row价值
      如果登录=然后退出重复
      设置login_w_id_row 2      重复
         设置logincomp列2细胞login_w_id_row价值
         如果logincomp =然后登录
            塔3的细胞login_row的设定值,以第1列的细胞login_w_id_row的值
            退出重复
         万一
         设置login_w_id_row为login_w_id_row + 1
      重复结束
      设置login_row为login_row + 1
   重复结束
告诉结束



解决方案

AppleScript的可能是多余的了你想要做什么。在数字文档,看看VLOOKUP函数,它传递的值来查找,一组细胞的查找,值的列返回。我得到了它的通过交换USER_ID并登录列的顺序只工作,但一旦我把在A列中的登录名和列B中USER_ID,设置单元格C1 = VLOOKUP(D2,A2:B7,2)返回121成功

in a numbers app table i have the following data

   A          B                     C                 D
user_id     login                user_id        login
2039        Abbott, Rachael                     Adams, Sue
110         Abbott, Shelby                      Adamson, Wendy
2910        Abraham, Binu                       Anderson, Daryl
121         Adams, Sue
122         Adamson, Anne
126         Adamson, Wendy

i am trying to write an applescript that will...

  1. iterate down logins in column D
  2. to find a matching login in column B
  3. take the value of the user_id in column A at the row where the match was found
  4. and place it into column C in the same row as the entry in column D

set dName to "correlationstudies.numbers"
set sName to "users"
set tName to "Table 1"
set login_row to 2
set login_w_id_row to 2

tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
   repeat
      set login to value of cell login_row of column 4
      if login = "" then exit repeat
      set login_w_id_row to 2

      repeat
         set logincomp to value of cell login_w_id_row of column 2
         if logincomp = login then
            set value of cell login_row of column 3 to value of cell login_w_id_row of column 1
            exit repeat
         end if
         set login_w_id_row to login_w_id_row + 1
      end repeat
      set login_row to login_row + 1
   end repeat
end tell

解决方案

AppleScript may be superfluous for what you're trying to do. In the numbers documentation, take a look at the VLOOKUP function, which is passed a value to look up, a set of cells to look up in, and the column of the value to return. I got it to work only by swapping the order of the user_id and login columns, but once I put the login in column A and the user_id in column B, setting cell C1=VLOOKUP(D2, A2:B7, 2 ) returned 121 successfully.

这篇关于AppleScript的比较单元格的值,然后一个单元格的值放到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆