Conditional formula

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

Conditional formula

Postby ajeeshvk » Fri Jan 25, 2013 6:58 pm

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

Postby zecyAledlyLer » Sun Jan 27, 2013 2:17 am

Absolutely casual concurrence
zecyAledlyLer
 
Posts: 2
Joined: Wed Jan 09, 2013 4:56 am

Re: Conditional formula

Postby ajeeshvk » Mon Jan 28, 2013 5:12 pm

Can some someone help for this scenario?

Thanks in advance
Ajeesh
ajeeshvk
 
Posts: 3
Joined: Wed Jan 23, 2013 6:58 pm

Re: Conditional formula

Postby amy.zhao » Tue Jan 29, 2013 7:14 am

Hello Ajeesh,

Thanks for your inquiry.
We are sorry for the delay response for the weekends here.
For your problem, we provide you a demo. Please check the code below. Hope it can help you.
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
User avatar
amy.zhao
 
Posts: 2279
Joined: Wed Jun 27, 2012 8:50 am

Re: Conditional formula

Postby ajeeshvk » Tue Jan 29, 2013 8:54 pm

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

Postby amy.zhao » Wed Jan 30, 2013 1:44 am

Hello Ajeesh,

Thanks for your reply.
Please feel free to contact us when you need any assistance.
Have a great day!

Thanks &Best Regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2279
Joined: Wed Jun 27, 2012 8:50 am


Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 0 guests