Forum Discussion
Compare Two Columns
- Oct 02, 2021
pbexpresss Hi. Assuming Excel 365, this is a way
XMATCH looks for all names among those reported.
ISERROR becomes true if they are not in the list of reported hours
FILTER shows all names that have not reported
=FILTER(G2:G6;ISERROR(XMATCH(G2:G6;A2:A4)))
Change G2:G6 to range in your workbook with all names.
Using the function LET makes it easier to read and test the different parts.
Last line is what the cell outputs and changing "output" to eg haveReport shows that part of the calculation.
I prefer to have the definitions indented.
=LET(allNames;G2:G6;
reportedNames;A2:A4;
haveReported;XMATCH(allNames;reportedNames);
haveNotReported;ISERROR(haveReported);
output;FILTER(allNames;haveNotReported);
output
)
It depends on which version of Excel you are, how your data is organized and in which form you'd like to see the result.
That could be helper COUNTIF() column with filtering on it, could be dynamic arrays formulae, could be conditional formatting, could be Power Query, whatever.
- bosinanderOct 02, 2021Steel Contributor
pbexpresss Hi. Assuming Excel 365, this is a way
XMATCH looks for all names among those reported.
ISERROR becomes true if they are not in the list of reported hours
FILTER shows all names that have not reported
=FILTER(G2:G6;ISERROR(XMATCH(G2:G6;A2:A4)))
Change G2:G6 to range in your workbook with all names.
Using the function LET makes it easier to read and test the different parts.
Last line is what the cell outputs and changing "output" to eg haveReport shows that part of the calculation.
I prefer to have the definitions indented.
=LET(allNames;G2:G6;
reportedNames;A2:A4;
haveReported;XMATCH(allNames;reportedNames);
haveNotReported;ISERROR(haveReported);
output;FILTER(allNames;haveNotReported);
output
)- wanalearnFeb 02, 2023Brass Contributor
=FILTER(G2:G6,ISERROR(XMATCH(G2:G6,A2:A4)))
thx for the answer, it was usfull for me as well, however if you want to copy &past do it from my post
since in the original answer, there is an error they put an ";" instead " ,"- bosinanderFeb 02, 2023Steel ContributorYes, the local settings on my computer uses semicolon instead of comma.
Opening the attached file though would adapt to your local settings as well as translated function names depending on your chosen language.
Thanks for the note 🙂
- pbexpresssOct 07, 2021Copper Contributor
bosinander The combination of functions worked perfectly. I created a file that maintains my master employee list. When I retrieve the file summarizing my employees' daily report submissions, the macro I created uses your suggestions to compare the list from one file with the other file. Then it gives me a list of employees who did not work that day at the bottom of the daily report submission report.
Thanks,
- SergeiBaklanOct 02, 2021Diamond Contributor
Thank you, but still better to have sample file.
If these are two different file you may use Power Query to compare data an return the table with records which don't meet condition.
- pbexpresssOct 02, 2021Copper ContributorI will give Power Query a try.
Thanks