Bug 170562 - Adding IF statement causes Err 504 or #VALUE!
Summary: Adding IF statement causes Err 504 or #VALUE!
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.8.4.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-02-01 22:59 UTC by teaman
Modified: 2026-02-02 02:44 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Blood pressure readings (729.54 KB, application/vnd.oasis.opendocument.spreadsheet)
2026-02-01 23:05 UTC, teaman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description teaman 2026-02-01 22:59:59 UTC
Description:
Device Name	SP
Processor	Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz   3.19 GHz
Installed RAM	16.0 GB (15.7 GB usable)
Storage	466 GB HDD HGST HTS725050A7E630, 238 GB SSD HFM256GDJTNI-82A0A
Graphics Card	Intel(R) HD Graphics 530 (128 MB)
Device ID	DDE3D60C-C5F1-48D4-B62F-644AF8E7645E
Product ID	00330-54938-32585-AAOEM
System Type	64-bit operating system, x64-based processor
Pen and touch	No pen or touch input is available for this display

Just updated to: 

Version: 25.8.4.2 (X86_64)
Build ID: 290daaa01b999472f0c7a3890eb6a550fd74c6df
CPU threads: 4; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Raster; VCL: win
Locale: en-CA (en_GB); UI: en-GB
Calc: CL threaded

Example: =IF(F10,"","",MEDIAN($F$10:$H$40))  Original: =MEDIAN($F$10:$H$40)
Did find this version returned a number: =IF(F10,"","",MEDIAN($F$10:$H$40))) (extra right bracket)

Returned to previous sheet (monthly data) and found all tabulated Mean, Median and Mode formulae changed to:

=IF(F10,"","",MEDIAN($F$10:$H$40)), except the original cell containing this formula, which with some cells either side was stuck in a selected state.

Clicked back to current monthly sheet, then back to it to find the cells deselected and all information deleted including borders.

Repeated the above and found all the tabulated cells correct.
                                                                                                                                                                   RIGHT SET
Systolic				Diastolic			        Pulse			    Systolic					Diastolic					Pulse			
Mode:	Err:504		Mode:	#VALUE!	Mode:	89		    Mode:	     #VALUE!		Mode:	#VALUE!		Mode:     #VALUE!
Median:	Err:504		Median:	80		        Median:	89		    Median:   #VALUE!		Median:	#VALUE!		Median:	#VALUE!
Average: 132		        Average: 80		        Average: 88		    Average:  #DIV/0!		Average:  #DIV/0!		Average:  #DIV/0!

Right set Value!, DIV/0! results from no values entered yet.  Left set #VALUE! may be a result of insufficient entries



Steps to Reproduce:
1. =MEDIAN($F$10:$H$40)
2. =IF(F10,"","",MEDIAN($F$10:$H$40))
3. Err 504

Actual Results:
ER 504

Expected Results:
Initially blank cell


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Device Name	SP
Processor	Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz   3.19 GHz
Installed RAM	16.0 GB (15.7 GB usable)
Storage	466 GB HDD HGST HTS725050A7E630, 238 GB SSD HFM256GDJTNI-82A0A
Graphics Card	Intel(R) HD Graphics 530 (128 MB)
Device ID	DDE3D60C-C5F1-48D4-B62F-644AF8E7645E
Product ID	00330-54938-32585-AAOEM
System Type	64-bit operating system, x64-based processor
Pen and touch	No pen or touch input is available for this display


Version: 25.8.4.2 (X86_64)
Build ID: 290daaa01b999472f0c7a3890eb6a550fd74c6df
CPU threads: 4; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Raster; VCL: win
Locale: en-CA (en_GB); UI: en-GB
Calc: CL threaded
Comment 1 teaman 2026-02-01 23:05:49 UTC
Created attachment 205302 [details]
Blood pressure readings
Comment 2 ady 2026-02-02 02:44:22 UTC
If I understand correctly, all you need to do is correct the formulas in:

* Cell I54:
_ from =IF(F10,"","",MEDIAN($F$10:$H$40))
_ to =IF(F10,"",MEDIAN($F$10:$H$40))

* Cell I53:
_ from =IF(F10,"","";MODE($F$10:$H$40))
_ to =IF(F10,"",MODE($F$10:$H$40))


If I understood correctly, this is not a bug report, but rather a question that should had been asked in some forum such as <https://ask.libreoffice.org>. I am therefore closing this report as invalid for now, but if you disagree please feel free to reopen it.