I will write a formula in Excel with WRITE CELL.
It is a formula “=IF(AX”+cntRow.ToString+“<>”+" “+”,2,ROUND((AG"+cntRow.ToString+“)))”
I think it doesn’t work because there is a <> in it. If I do the same formula with = it won’t work either.

why is this formula not working?
cnt.Row.ToString is counting the rows.

@AlexJank makes a good point.
If you are checking a cell with a string, then the formula should have quotes in it, so you need to embed the quotes in your formula so it can correctly have " " as part of the formula.
(ie +cntRow.ToString+“<>”“” “”“” ) or something like that

A good way to check your formula string is to output it with Write Line or Message Box, so you can see what you are inputting into the cell beforehand.