Search code examples
google-apps-scriptgoogle-sheetsfiltermatchlookup

Google Spreadsheet trick


Here is sheet 1: enter image description here

Here is sheet 2: enter image description here

From a Google Spreadsheet, each time I have a ticker/symbol from sheet 2 which is also in sheet 1, I want to copy and paste the line from sheet 1 into sheet 3. Here is a test spreadsheet: https://docs.google.com/spreadsheets/d/1GxljIY-lm5P-pTssKlRAQoyozdb_fhADhpIfUvWkdqo/edit?usp=sharing. Do I have to build a macro or I can use the FILTER() and LOOKUP()function? How can I do that easily?


Solution

  • use:

    =FILTER(Sheet2!A2:I, COUNTIF(Sheet1!A2:A, Sheet2!A2:A))
    

    enter image description here