Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
FPSpreadsheet
»
Error, the IF function does not handle the error correctly
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
about lazarus and android
by
zzzzzzz7
[
Today
at 04:06:51 am]
Olympic Rings (Interleave...
by
speter
[
Today
at 03:57:10 am]
Seven Kings (inc)
by
speter
[
Today
at 03:37:23 am]
Unit decfloat
by
speter
[
Today
at 02:46:47 am]
Remove region adjacent to...
by
n7800
[
Today
at 02:33:35 am]
Adjacent rectangles not a...
by
ron.dunn
[
Today
at 01:31:51 am]
Fast Canvas Library V1.05...
by
Gigatron
[
Today
at 12:44:57 am]
CudaText editor (written ...
by
szlbz
[
Today
at 12:01:23 am]
Tutorial on creating a co...
by
Roland57
[January 16, 2026, 08:29:55 pm]
Newly revised TlistBox in...
by
wp
[January 16, 2026, 06:23:04 pm]
How to forward a Class in...
by
Hartmut
[January 16, 2026, 05:21:35 pm]
How to low level manage S...
by
Tommi
[January 16, 2026, 04:05:54 pm]
Drag and Drop Files; onDr...
by
msintle
[January 16, 2026, 01:27:54 pm]
AI, NLP and CAI: Text Gen...
by
microxa
[January 16, 2026, 12:13:42 pm]
[Solved] Stacked bars not...
by
wp
[January 16, 2026, 10:57:01 am]
Theoretical question. Laz...
by
Petrus Vorster
[January 16, 2026, 09:49:47 am]
[solved] Printout in Prin...
by
wwerner
[January 16, 2026, 07:25:31 am]
The compiler fails to war...
by
dseligo
[January 16, 2026, 01:41:21 am]
Embedded qss stylesheets ...
by
big_M
[January 16, 2026, 12:52:34 am]
Mapping Images Like Odome...
by
SandyG
[January 15, 2026, 11:57:50 pm]
StrToDateTime problems
by
Aruna
[January 15, 2026, 11:56:02 pm]
unit init, finalize and i...
by
PascalDragon
[January 15, 2026, 09:46:49 pm]
Why does FPC behave this ...
by
PascalDragon
[January 15, 2026, 09:26:24 pm]
Pyramid solitaire, re-wri...
by
TBMan
[January 15, 2026, 09:21:07 pm]
Tzipper giving error on M...
by
Josh
[January 15, 2026, 08:46:02 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Error, the IF function does not handle the error correctly (Read 2026 times)
veb86
Jr. Member
Posts: 93
Error, the IF function does not handle the error correctly
«
on:
February 06, 2025, 07:26:49 am »
If there is an error in one of the results of the IF formula condition, then the error is shown if the condition points to this result
Example
= IF(1>0;1;#N/A) => result:1
= IF(0>1;1;#N/A) => result:#N/A
Logged
wp
Hero Member
Posts: 13332
Re: Error, the IF function does not handle the error correctly
«
Reply #1 on:
February 06, 2025, 11:04:24 am »
What did you expect? When the 1st argument is true, the formula returns the 2nd argument (1), otherwise the third argument (#N/A). That's what is happening in Excel and in FPSpreadsheet.
I don't understand how the posted sample project relates to this.
Logged
veb86
Jr. Member
Posts: 93
Re: Error, the IF function does not handle the error correctly
«
Reply #2 on:
February 06, 2025, 12:37:27 pm »
Sorry, I didn't explain it well.
Excel:
= IF(1>0;0;#N/A) => result:0
= IF(0>1;0;#N/A) => result:#N/A
FPSpreadsheet:
= IF(1>0;0;#N/A) => result:#N/A
= IF(0>1;0;#N/A) => result:#N/A
I made the example simpler and gave a screenshot
«
Last Edit: February 06, 2025, 12:39:06 pm by veb86
»
Logged
wp
Hero Member
Posts: 13332
Re: Error, the IF function does not handle the error correctly
«
Reply #3 on:
February 06, 2025, 01:49:05 pm »
Are you using a recent version of FPSpreadsheet (from ccr)? It now produces the same output as Excel. I spent lots of time during the last weeks to look at all these borderline cases and write unit tests for them.
Logged
veb86
Jr. Member
Posts: 93
Re: Error, the IF function does not handle the error correctly
«
Reply #4 on:
February 06, 2025, 02:25:07 pm »
I checked. The library has been updated to r9615.
I have attached a screenshot. My other errors have been fixed.
Logged
wp
Hero Member
Posts: 13332
Re: Error, the IF function does not handle the error correctly
«
Reply #5 on:
February 06, 2025, 05:09:15 pm »
Quote from: veb86 on February 06, 2025, 02:25:07 pm
My other errors have been fixed.
Does this mean that the IF bug is still present? It is not for me (using r9615, but this did not change anything related to this bug)
Logged
veb86
Jr. Member
Posts: 93
Re: Error, the IF function does not handle the error correctly
«
Reply #6 on:
February 06, 2025, 09:30:49 pm »
I think you have an uncommitted section of code. This happens, please check again.
My mentor also checked and he has the same error.
Logged
wp
Hero Member
Posts: 13332
Re: Error, the IF function does not handle the error correctly
«
Reply #7 on:
February 06, 2025, 10:30:54 pm »
Finally got it (recently, I had investigated error propagation in Excel, found that the first error found among the arguments usually determines the formula result, and had applied this "rule" also to the IF function). Fixed in r9620.
Logged
veb86
Jr. Member
Posts: 93
Re: Error, the IF function does not handle the error correctly
«
Reply #8 on:
February 07, 2025, 06:47:30 am »
The error has been resolved. Thank you!
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Packages and Libraries
»
FPSpreadsheet
»
Error, the IF function does not handle the error correctly
TinyPortal
© 2005-2018