conditional formula

25 views
Skip to first unread message

Jim S

unread,
Jan 27, 2012, 4:32:50 PM1/27/12
to python-excel
Hi

I'm trying to put the following formula into a spreadsheet:

=IF(S18+5<V18,S18+5,V18)

using

max5Up = Formula('=if(S%s+5<V%s,S%s+5,V%s)' % (rowNumber+1,
rowNumber+1,
rowNumber+1,
rowNumber+1))

and am getting:

xlwt.ExcelFormulaParser.FormulaParseException: can't parse formula
=if(S3+5<V3,S3+5,V3)

Can xlwt handle conditional formulae like this?

John Machin

unread,
Jan 27, 2012, 5:04:06 PM1/27/12
to python...@googlegroups.com
The = is not part of the formula; it's what you type into Excel to let it know that you are typing a formula, not text. Lose the =.

Consider looking at the tutorial available via http://www.python-excel.org

Jim Steil

unread,
Jan 27, 2012, 5:03:45 PM1/27/12
to python...@googlegroups.com

Jeez, why couldn’t I see that??  You’d think I’d notice all my other formulas don’t have the = sign.

 

Sometimes you stare at the screen too long….

 

Thanks, I really appreciate your help and this great tool.

 

                -Jim

--
You received this message because you are subscribed to the Google Groups "python-excel" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/python-excel/-/JSDppwbC2TAJ.
To post to this group, send an email to python...@googlegroups.com.
To unsubscribe from this group, send email to python-excel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-excel?hl=en-GB.

John Machin

unread,
Jan 27, 2012, 5:34:51 PM1/27/12
to python...@googlegroups.com
By the way, if(S3+5<V3,S3+5,V3)  is the same as min(S3+5,V3)

Jim Steil

unread,
Jan 27, 2012, 5:33:42 PM1/27/12
to python...@googlegroups.com

Yes, but I have to add more conditions to it as well.  Thanks for the tip though…

 

                -Jim

--

You received this message because you are subscribed to the Google Groups "python-excel" group.

To view this discussion on the web, visit https://groups.google.com/d/msg/python-excel/-/jh8YOQPhDqEJ.

Reply all
Reply to author
Forward
0 new messages