1

My question is as follows.

How can I apply the following excel formula
=COUNTIF('OtherSheet'!A2:A1500,"<>"&"") to a specific cell, via C# code?

I ask this because i can't use my following code because of the multiple.

Code as follows:

xlWorkingSheet.Cells[4, 2].Formula = "=COUNTIF('OtherSheet'!A2:A1500,"<>"&"")";

Any sort of help would be appreciated.

Adi Mohan
  • 117
  • 1
  • 16
  • 2
    You can add a `"` to your string like this: `\"`. Read [this answer](http://stackoverflow.com/questions/3905946/how-to-add-doublequotes-to-a-string-that-is-inside-a-variable) for an example. –  Dec 16 '16 at 12:08

1 Answers1

1

Try to use the below solution:

xlWorkingSheet.Cells[4, 2].Formula = "=COUNTIF('OtherSheet'!A2:A1500,\"<>\"&\"\")"
Aliaksei Futryn
  • 461
  • 5
  • 8