I have a column with 1,2 & 3’s and I am trying to find a pattern that will act as a sell trigger. I need four separate formulas for four different triggers to analyze.

#1- any pattern with 2 of the same and any 3rd, i.e. YXX, XYX, XXY

#2 same as #1 but looking back where Y has not been in the previous 3 rows prior to the trigger.

#3 Specific pattern any number 1st and the same number in 2nd and third position i.e. YXX

#4 same as #4 but looking back where Y has not been in the previous 3 rows prior to the trigger.

Any help with this would be great