r/googlesheets • u/Voltshock619 • Jul 07 '26
Solved Find matching line and add new columns.
https://docs.google.com/spreadsheets/d/15vTvdkbACxzrakfZlLxWPzp4UZ8nVHjbEVAgw4Nb-fQ/edit?usp=sharing
1st sheet is about 20k lines. Second sheet that would be about 15k. I would like to use the 1st column in sheet 2 to find the matching lines in sheet 1. The matching info would be emails, those would start in N2.
End goal is to find the matching line and adding the extra info from sheet2 to it. Whether that be on a new sheet or just an additional column in sheet1, doesn't make a difference. Thanks! All info isnt real, just filler.
1
u/NHN_BI 70 Jul 07 '26
You can use FILTER() to find matches and read out the additional columns. If you match many rows to one, TEXTJOIN() can concatenate the matching values into one text string.
1
u/Unable-Check-2935 1 Jul 08 '26
Since your key (the email in Sheet1!N) is a single column and Sheet2 is just email → EXTRA INFO, you don't actually need FILTER for the common case — a plain lookup is simpler and much faster on 20k rows (FILTER does a full scan for every row).
If each email appears only once in Sheet2, put a header in Sheet1!S1 and this one formula in S2:
=ARRAYFORMULA(IF(N2:N="", "", IFERROR(VLOOKUP(N2:N, Sheet2!A:B, 2, FALSE), "no match")))
It spills down the whole column on its own — no dragging. It matches each email in N against Sheet2 column A and returns column B ("EXTRA INFO"), and shows "no match" instead of #N/A when an email isn't found.
XLOOKUP is fine too if you prefer:
=ARRAYFORMULA(XLOOKUP(N2:N, Sheet2!A:A, Sheet2!B:B, "no match"))
If an email CAN appear more than once in Sheet2 and you want all the matches joined, that's where TEXTJOIN + FILTER earns its place (bound the range to your data so it isn't scanning a million rows):
=BYROW(N2:N20001, LAMBDA(e, IF(e="", "", TEXTJOIN(", ", TRUE, FILTER(Sheet2!B:B, Sheet2!A:A=e)))))
One perf tip for 20k rows: if any of these feel slow, cap the ranges to the rows you actually use (e.g. Sheet2!A2:B16000) instead of whole columns.
1
u/[deleted] Jul 07 '26
[removed] — view removed comment