• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel table relationship

Nitinkadam

New Member
In Excel, I have Column A with ID number. Suppose:

1001
1002
1003
2001
1002
1001
2002
1002
in A1 to A8. Now I want to identify where 2001 starts and ends with 2002. Meaning values corresponding to 1001 in B1 will be zero (since 2001 is not detected). Similarly for 1002, 1003 will be 0. So B1, B2, B3 = 0. Now B4 should be one, since A4=2001. Values B5 onwards will continue to be one for all following values of A till 2002 is sensed, ie A7. Again following values will be 0 till 2001 is sensed.
 
Hi !

Formula in B1 cell : =IF(A1=2001,1,0)

Formula in B2 cell : =IF(A2=2002,0,IF(A2=2001,1,B1))
Copy down …

If 2002 must also be equal to 1,
formula in B2 cell : =IF(A2=2001,1,IF(A1=2002,0,B1))
 
Back
Top