Sam Toufaili
Sam Toufaili

Reputation: 15

Adding multiple conditions to separate tabs, in a sheet, when using Query

in Google Sheets, I am trying to combine values found in separate columns, from 2 tabs, into one column, in a third tab (Tab 3). There are a number of conditions that I would like to add so specific values are extracted to Tab3. How do I add conditions when querying in Tab3?

here is an example

Tab1 ID Value 1 CL1 2 CL2 3 CL3 4 CL4 5 CL5 6 CL6

Tab 2

ID Value 111 v1 222 v2 3 v3 444 v4 v5 6 v6 777 v7 888 v8 999 v9

in Tab3, I'd like to: 1- Extract all values in Tab2, that are not included in Tab1 2- If there are values in Tab2 that are equal to Tab1, then use the value in Tab2, when added to Tab3 3- If there are values in Tab2 that do not exist in Tab1, then add those values too 4- Disregard any empty cells after the last column value

All 3 conditions should be added into 1 column in Tab 3

Any ideas?

Upvotes: 0

Views: 109

Answers (1)

Martín
Martín

Reputation: 10187

Try something like this;

=LAMBDA(un,{FILTER(un,un<>""), BYROW(FILTER(un,un<>""),LAMBDA(id,IFNA(VLOOKUP(id,{Tab2!A2:B;Tab1!A2:B},2,0))))})
(UNIQUE({Tab1!A2:A;Tab1!A2:A}))

Upvotes: 0

Related Questions