excelexcel-formulacompare

requesting excel formula to compare columns but going in order and skipping blanks


Trying to setup a formula in excel to compare 2 colums, sample data set below. Considering there will be blanks in column B and we must go in order

Column A Column B Column C
3 3 match
4 3 difference
5 blank skipped
6 5 match
6 5 difference
8 6 match
blank blank skipped
blank 8 match

Tried a few formulas but not giving the results required

=IF(B1="", "", IF(ISNUMBER(MATCH(A1, IF(B:B<>"", B:B), 0)), "Match", "Difference"))

=IF(AND(A1<>"", B1<>"", A1=B1), "Match", IF(B1="", "", "Difference"))

=IF(A1<>"", IFERROR(IF(ISBLANK(B1), IFERROR(INDEX(B:B, MATCH(FALSE, ISBLANK(B:B), 0)), ""), IF(A1=B1, "Match", "Difference")), ""), "")

Solution

  • Use a nested if with COUNTIF

    =IF(B1="","skipped",IF(COUNTIF(A:A,B1)>=COUNTIF($B$1:B1,B1),"match","difference"))
    

    enter image description here