## Conditional formula

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

### Conditional formula

Hi,

I have a question , how to add a conditional formula to a cell in the excel document?

I would like to add a formula '=IF(H7>0,(IF(F7 > 0,(H7-F7)/F7,"")),"")' to a cell 'J7'. Can I get help for this scenario in C#.

Thankyou,

Ajeesh
ajeeshvk

Posts: 3
Joined: Wed Jan 23, 2013 6:58 pm

### Re: Conditional formula

Absolutely casual concurrence
zecyAledlyLer

Posts: 2
Joined: Wed Jan 09, 2013 4:56 am

### Re: Conditional formula

Can some someone help for this scenario?

Ajeesh
ajeeshvk

Posts: 3
Joined: Wed Jan 23, 2013 6:58 pm

### Re: Conditional formula

Hello Ajeesh,

We are sorry for the delay response for the weekends here.
Please tell us if you have any problem.

Code: Select all
`            Workbook workbook = new Workbook();            Worksheet worksheet=workbook.Worksheets[0];            string f = @"=IF(H7>0,(IF(F7 > 0,(H7-F7)/F7,"""")),"""")";            worksheet.Range["J7"].Formula = f;            worksheet.Range["F7"].NumberValue = 5;            worksheet.Range["H7"].NumberValue = 4;            workbook.SaveToFile("sample.xlsx",ExcelVersion.Version2007);`

Thanks & Best Regards,
Amy
E-iceblue support team

amy.zhao

Posts: 2279
Joined: Wed Jun 27, 2012 8:50 am

### Re: Conditional formula

Hi Amy,

Thank you very much for your valuable reply.. It works fine..really appreciate it..
Spire.XLS is a really nice library..saved lot of time..thanks alot..

Ajeesh
ajeeshvk

Posts: 3
Joined: Wed Jan 23, 2013 6:58 pm

### Re: Conditional formula

Hello Ajeesh,

Have a great day!

Thanks &Best Regards,
Amy
E-iceblue support team

amy.zhao

Posts: 2279
Joined: Wed Jun 27, 2012 8:50 am