If your data begins in A1 on both sheets then the formula would go in cell B1 of sheet 2 and would look like.
=If(Sheet1!A1="Blue",1,If(Sheet1!A1="Red",2,""))
Then copy it downd columns B by dragging. The formula will automatically change the row number as it is copied down.
If you used the A5 reference but entered the formula on a different row than row 5 then it would not give accurate results. The row reference has to be the same from sheet to sheet. Also, you did not mention the Green in the OP. If you have threes options then the formulat would be
=If(Sheet1!A1="Blue",1,If(Sheet1!A1="Red",2,If(Sheet1!A1="Green",3,"")))
Bookmarks