Search code examples
arraysif-statementgoogle-sheetsfiltergoogle-query-language

Google sheets Find next numeric value from the colnums


I have two rows with SKUs, one comes from one database, and another one from another one. As you can see in the visual example SKUs with values 1, 2, 4 & 5 are present in both databases.

https://i.sstatic.net/KlTCr.png

I start with number 1 and I need a formula that would bring up the next valid number (in this case number 2) that is present in both columns.

I would need a formula that would do the following: If I lookup 1 it should bring 2 If I lookup 2 it should bring 4 If I lookup 4 it should bring 5

Thank you in advance


Solution

  • try:

    ={FILTER(B2:B16, COUNTIF(E2:E16, B2:B16)), 
     {QUERY(FILTER(B2:B16, COUNTIF(E2:E16, B2:B16)), "offset 1", ); ""}}
    

    enter image description here