I have a very long table in this format:

Table:
B  | C | D | 
----------------
c10|mnp|   |
------------
c12|abc|dif|
------------
c15|xyz|   |
------------
c17|abc|equ|
------------
c17|mnp|   |
------------
c18|abc|dif|
------------
c19|xyz|   |
------------
c21|uck|   |
------------
c25|qkj|   |
------------
c25|abc|equ|
------------
c26|npk|   |
------------

The code in my normal understanding is like this:

FOR (whole Sheet or whole range of C column ($C$1:$C$8000) )
    IF $C(i) = "abc" then
      IF (($B(i) == $B(i-1)) OR (($B(i) == $B(i+1))
      THEN:
           assign value $D(i) = "equ"
      ELSE
           assign value $D(i) = "dif"

It is quite straight forward in normal programming language but I really don't know is it possible to code that in excel and how to execute that code ? My table is really very long and I can not do it manually!

有帮助吗?

解决方案

If you are looking for a simple formula to use Column D, then you can just enter this in D2 and then drag down to autofill =IF(C2="abc",IF(OR(B1=B2,B3=B2),"equ","dif"),"") @simoco makes a great point that you should check out the available documentation prior to posting here as this site is intended to help solve problems after you have tried things out first.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top