Hi. I have a column that has numbers. (The first number will always be positive). I would like to get a "flag" (1 in another column) whenever the data goes from positive to negative and then positive again (no need for back to back to back). If I get a 1 it should stop looking at this pattern and look to find the next negative and get a 2 then. When that happens start finding for the 1 again (the first pattern). Here is an example to understand.
Column A Column B
3.86%
3.79%
-2.88%
-2.33%
3.36% 1
2.07%
4.65%
-3.87% 2
3.88%
-3.32%
8.20% 1
-0.46% 2
1.49%
2.62%
So, at B5 I get 1 because we have a positive first (A1) then at A3 a negative and then at A5 a positive. Now that it got the 1 it will look for the first negative which it gets at A8.
After that, it tries to find the 1 again. A9 is positive, A10 is negative and A11 is positive so B11 will be 1. A12 is negative so B12 will be 2.
I don't have a specific preference for a formula or a macro.
Hope you understand what I'm trying to do!
Thanks for any help!
P.S. I have asked the same question in another forum Find pattern (positive, negative, positive)
Column A Column B
3.86%
3.79%
-2.88%
-2.33%
3.36% 1
2.07%
4.65%
-3.87% 2
3.88%
-3.32%
8.20% 1
-0.46% 2
1.49%
2.62%
So, at B5 I get 1 because we have a positive first (A1) then at A3 a negative and then at A5 a positive. Now that it got the 1 it will look for the first negative which it gets at A8.
After that, it tries to find the 1 again. A9 is positive, A10 is negative and A11 is positive so B11 will be 1. A12 is negative so B12 will be 2.
I don't have a specific preference for a formula or a macro.
Hope you understand what I'm trying to do!
Thanks for any help!
P.S. I have asked the same question in another forum Find pattern (positive, negative, positive)