需要根据相邻列的值查找/replace一列中的值

无需编写VBA代码,是否有办法编写一个公式来执行以下操作:

  • 通过每一行迭代(比如说$ i)。
  • 如果价值(B,$ i)= 2000&(A,$ i)= 1,改变(B,i)= 3327

谢谢

弄清楚了。

=IF(B2=1,C2,IF(C2=2000,3325,IF(OR(C2=2001,C2=102),3327,IF(C2=2003,3329,C2)))) 

如果语句包装在For循环中:

 Dim x 'Beginning Row Dim y 'Ending Row For myLoop = x to y If Cells(x,1)= 2000 and Cells(x,2) = 1 then Cells(x,3 [or a formula to calculate] )=3327 End If Next myLoop