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
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
GTK3 still alpha
by
Thaddy
[
Today
at 04:26:17 pm]
DateUtils *Span and *Betw...
by
Чебурашка
[
Today
at 04:24:02 pm]
Mixing LazMapViewer and O...
by
wp
[
Today
at 04:12:31 pm]
Lazarus Release Candidate...
by
cdbc
[
Today
at 03:54:05 pm]
SIMD QuickSort
by
mikerabat
[
Today
at 01:57:44 pm]
Fast Fourier Transform (F...
by
Thaddy
[
Today
at 12:02:39 pm]
[SOLVED] suddenly i have ...
by
CharlyTango
[
Today
at 11:29:56 am]
Problems with Lazaruz 3.8...
by
salvadordf
[
Today
at 11:22:35 am]
"database not open" - IBX...
by
CharlyTango
[
Today
at 11:20:22 am]
Weird error: component no...
by
wp
[
Today
at 10:22:28 am]
Very Slow Online Package ...
by
Marc
[
Today
at 09:52:13 am]
Velthuis.Console.pas - Wo...
by
Thaddy
[
Today
at 08:55:31 am]
No fpc found on a fresh i...
by
Thaddy
[
Today
at 08:30:15 am]
Lazarus is not working
by
Thaddy
[
Today
at 08:18:33 am]
Rest API chunk file downl...
by
daniel_sap
[
Today
at 07:49:00 am]
Peano Fractals: Rainbow t...
by
Boleeman
[
Today
at 07:19:37 am]
Drive a tank around the s...
by
Boleeman
[
Today
at 06:22:40 am]
DuckHunter Game
by
TRon
[
Today
at 04:19:56 am]
Saving a TImage with a tr...
by
EganSolo
[
Today
at 03:05:03 am]
NIL vs. Assign: when to u...
by
440bx
[
Today
at 01:08:36 am]
Lazarus Instalation Error...
by
TRon
[March 24, 2025, 10:19:44 pm]
How to download/compile l...
by
Theo11
[March 24, 2025, 09:33:30 pm]
IDE tabs and spaces, auto...
by
Martin_fr
[March 24, 2025, 09:17:07 pm]
(Solved) Illegal paramete...
by
PascalDragon
[March 24, 2025, 09:03:12 pm]
MOVED: Trunk 3.3.1 access...
by
PascalDragon
[March 24, 2025, 08:58:18 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Error, the IF function does not handle the error correctly (Read 1033 times)
veb86
Jr. Member
Posts: 92
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: 12702
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: 92
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: 12702
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: 92
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: 12702
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: 92
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: 12702
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: 92
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