Multiple vlookup

Raju1
New Member

How can find value City to pincode in four tabs.

0 6 122
6 REPLIES 6

There is no equivalent of UNION in AppSheet, you can merge lists but that may not be efficient and could result in having to add some additional logic in multiple places depending on your exact requirements. If you have edit access to the spreadsheet, why not just create an additional tab which includes all entries from all tabs using QUERY?

Update to add an example of the query formula in a fifth tab in the Google Sheet

=query({DEHLI!A:B;UP!A:B;BIHAR!A:B;UJARAT!A:B}, "select * where Col1 is not null", 0)

There isโ€ฆit is simply list Addition โ€œ+โ€. Since all SETS are represented as lists you just need to add the two lists together:

`SELECT (Table A[ID], โ€ฆ) + SELECT (Table A[ID], โ€ฆ)

Of course the lists need to be compatible.

Thatโ€™s what I meant when I said you could โ€˜merge listsโ€™, but I donโ€™t think that is quite as straightforward as a UNION in a select statement and if there are multiple columns it can quickly get complicated when writing expressions. Having said that, is it possible to merge the lists once in a slice which could then be used elsewhere?

You may have missed the point that ALL List functions in AppSheet return a SINGLE column list of values - not a set of columns. That single column is either a Key column or a Value column. Key columns can be used as โ€œpointersโ€ to rows.

So, to answer your question, in AppSheet you can do this:

Slice1[Key] + Slice2[Key] + Slice3[Key] + Slice4[Key]

It is analogous (but not directly equivalent) to this in a database:

SELECT * FROM Slice1 Table
UNION
SELECT * FROM Slice2 Table
UNION
SELECT * FROM Slice3 Table
UNION
SELECT * FROM Slice4 Table

In AppSheet you will have a list of Keys - pointers to the rows. AppSheet knows by context that these are row references and can access any of the column data.

If all sheets are very similar, My recommendation would be to add a column for the Tab name, for filtering purposes, and simply combine all tabs into one as a single AppSheet Table. Then no merging is needed at all and you can easily break them into Slices if needed for the app.

Yes this would be a good approach, it should be possible to populate the additional column through the same query statement so that it updates automatically and then as you say it would avoid all merging while retaining the ability to split out slices.

Top Labels in this Space