Write formula excel

hi friends

I want to type the below formula into excel cell for the whole column.
=IF(AND(K2>J2,K2>I2),“Enter comment”,“”)

i want to pass the cell Number dynamically as below. but getting error.
can you help me .

“=IF(AND(K”+RowIndex.toString+“>J”+RowIndex.toString+“,K”+RowIndex.toString+“>I”+RowIndex.toString"),“+”“Enter comment”+“,”“)”.ToString
image

Hello @oshan

Try this mate
“=IF(AND(K” + RowIndex.toString+“>J”+RowIndex.toString+“,K”+RowIndex.toString+“>I”+RowIndex.toString + “),”+“”“Enter comment”“” + “,” + “”“”“” + “)”

you are missing one (+) sign after RowIndex.toString

3 Likes

OMG…silly mistake … :neutral_face: thanks a lot… :pray:

No problem mate @oshan ,

I have some trick if you want to apply this formula to every row in your datatable you don’t need to put RowIndex.tostring
your formula will look like this (if you start from second row)

“=IF(AND(K2>J2,K2>I2),”+“”“Enter comment”“” + “,” + “”“”“” + “)”

then you assign in range you want such as “AF2:AF100”, excel will automatically generate next row for you.

hope this help !!!

1 Like

@PlutoPeaM thanks , but it has to change the cell no also.
“=IF(AND(K2>J2,K2>I2),”+“”“Enter comment”“” + “,” + “”“”“” + “)”
when its 3rd row, it should be
“=IF(AND(K3>J3,K3>I3),”+“”“Enter comment”“” + “,” + “”“”“” + “)”

Yes, when it 3rd row excel will automatically put 3 instead of 2 but you need to define your range such as “AF2:AF10” it will put this formula start from AF2 and end at AF10 and your formula will update number of row automatically

1 Like

Thanks @PlutoPeaM… i ll try it…
I dont know what am missing. :sleepy: getting error in the below formula too…
sorry but can you help me with this.

=IF(AND(K2>J2,K2>I2),“1”,“”)

=IF(U2=“1101”,IF(AND(K2<=I2,K2<=J2,MONTH(J2)<>MONTH(K2),E2<>“O”),“”,IF(AND(E2=“O”,K2<=I2,K2<=J2),J2,K2)),K2)

Try this @oshan ,

  1. “=IF(AND(K2>J2,K2>I2),” + “”“1"”" + “,” + “”“”“” + “)”
  2. “=IF(U2=”+“”“1101"”" + “,IF(AND(K2<=I2,K2<=J2,MONTH(J2)<>MONTH(K2),E2<>” + “”“O”“” + “),” + “”“”“” + “,IF(AND(E2=” + “”“O”“” + “,K2<=I2,K2<=J2),J2,K2)),K2)”
2 Likes

thanks a lotttt :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.