title: Check data from another sheet in a column to reference the data in the row
body: <p>I work for a School district and we touch a lot of laptops everyday and have to write down all kinds of data to track them to make sure we do not lose them.</p>
  <p>I am using sheets to do this but I notice that with every laptop I have to write down the District ID that we have assigned to the laptop, the asset tag assigned by Dell to the laptop and what school site the laptop belongs to.</p>
  <p>I have a database that exports three pieces of data, the District ID, Asset tag, and Site that it belongs to so I was able to get that database exported daily and uploaded to drive then I got sheets to talk to drive and upload the data into sheet(tab) 2 on to the workbook.</p>
  <p>What I would like to do is make it so that if I scan a District ID into sheet 1 on the work book it will reference sheet 2 and grab the other corresponding data on its own I would also like to do it so that if a laptop is missing the district id I can type in the asset tag instead and it will grab the corresponding data that goes along with it so no matter what if I type the district ID or the asset tag it will fill in the rest for me. I want to do this with a script since I will be doing a few thousand laptops in a year and would rather not use a formula as well as I am trying to use java to help teach myself I was already able to setup emails from sheets I just can't figure out how to do this... Any help would be greatly appreciated.</p>
  <p>Sheet one is formatted with column 1 being District ID column 2 being asset tag and column 3 being site</p>
  <p>Sheet two is formatted with the same format but is actually filled out since it is the database export that I mentioned above.</p>
  <p>Below is a copy of the sheet for reference. <a href="https://docs.google.com/spreadsheets/d/1702fWyip4FurU1nNSGxrs0kC1uvbHAxRIlqARBsoC2g/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1702fWyip4FurU1nNSGxrs0kC1uvbHAxRIlqARBsoC2g/edit?usp=sharing</a></p>
  <p>So I did write up a formula that would work just so you guys can see but the problem is that unless the date is filled out it shows #ref error and it just looks tacky which is why I would much rather just do it in a script that runs when a cell is edited
  =IF(ISNUMBER(MATCH(B2,Excel!$B$2:$B$46000,0)),INDEX(Excel!$A$2:$A$3222,MATCH(Statuses!B2,Excel!$B$2:$B$46000,0)),0)</p>