No, each item can have different codesAre the codes always the same per item number
Yes, I got it wrong, and it is possible that an item will not exist at all in the next monthI mean, if 100304625 is 166 in November, is it always 166 in October? Otherwise there would be meaningless since there will be a small probability that each can match with the given codes above.
=IF(COUNTIF($B$1:$F$1,VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,2,0))>0,IF(OR(AND(VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$A$5:$C$20,3,0)=0,VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,3,0)>0),AND(VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$A$5:$C$20,3,0)>0,VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,3,0)=0)),INDEX(A$5:A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),""),"")
=IFERROR(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,2,0))>0,IF(OR(AND(VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$A$5:$C$20,3,0)=0,VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,3,0)>0),AND(VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$A$5:$C$20,3,0)>0,VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,3,0)=0)),INDEX(A$5:A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),""),"")
Thank you, it really helped meOK,
I removed October code check. Now it checks code only for November. If it's OK, then OK.
Excel Formula:=IFERROR(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,2,0))>0,IF(OR(AND(VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$A$5:$C$20,3,0)=0,VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,3,0)>0),AND(VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$A$5:$C$20,3,0)>0,VLOOKUP(INDEX($A$5:$A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),$G$5:$I$20,3,0)=0)),INDEX(A$5:A$20,SMALL(IF($B$5:$B$20=$B$1:$F$1,ROW($A$1:$A$16)),ROWS($A$1:A1))),""),"")