Hi
First you need to identify if it exists.
Try VLOOKUP Function
example, colum A has all existing CODE
in cell D1 you put the Code to search
in cell E1 you write the formula
=vlookup(D1, A:A, 1, false)
if the result is #N/A, the code you are searching is not in the list
If you found it, the code will be written here.
For automaticaly write the "unknown" code elswhere you need a macro.
But if you work with barcodescanner, it should scan, write the code, and move to the next cell
Simply, copy/paste the E1 formula to 2000 rows for example.
Then select D1, and start scanning, all E cells will be update as soon as you do your BEEP scan action.
All this would solve your issue.
All the best !