IFERROR formula from Excel

Discuss the spreadsheet application
Post Reply
Mardana
Posts: 8
Joined: Fri Oct 25, 2024 3:38 am

IFERROR formula from Excel

Post by Mardana »

I have an Excel spreadsheet sent to me with the following formula in various cells. iferror(L18/L19;0) When I apply it to OO I get the following #NAME?
=if(iserror(SUMPRODUCT((((--TEXT($B5;"[mm]")<=--TEXT(MOD($Data.$E$5:$E$2550;1);"[mm]"))*(--TEXT($C5;"[mm]")>=--TEXT(MOD($Data.$E$5:$E$2550;1);"[mm]")))*($Data.$E$5:$E$2550<>""))*(Q$4=$Data.$I$5:$I$2550));SUMPRODUCT(((if(iserror((--TEXT($B5;"[mm]")<=--if(iserror(--TEXT(--MID($Data.$E$5:$E$2550;FIND(" ";$Data.$E$5:$E$2550)+1;LEN($Data.$E$5:$E$2550));"[mm]");0));0)*if(iserror((--TEXT($C5;"[mm]")>=--if(iserror(--TEXT(--MID($Data.$E$5:$E$2550;FIND(" ";$Data.$E$5:$E$2550)+1;LEN($Data.$E$5:$E$2550));"[mm]");0));0)*($Data.$E$5:$E$2550<>""))*(Q$4=$Data.$I$5:$I$2550)))). Can someone please advise the solution to how to fix this Excel formula to OpenOffice.
 Edit: Split from Add column to page 1 printout as this is a different question. 
Last edited by MrProgrammer on Sun Nov 10, 2024 5:56 pm, edited 1 time in total.
Reason: Add IFERROR to topic subject, for searching
Open office 4.1.3
FJCC
Moderator
Posts: 9457
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Formula from Excel to OO

Post by FJCC »

Mardana wrote: Tue Oct 29, 2024 2:57 am iferror(L18/L19;0)
OpenOffice does not have the iferror() function. You can get the same result with

Code: Select all

=IF(ISERROR(L18/L19);0;L18/L19)
I can't make any sense out of the second formula you posted. Is that the complete formula?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
robleyd
Moderator
Posts: 5265
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Formula from Excel to OO

Post by robleyd »

OpenOffice Calc does not have the function IFERROR; you'll need to re-write the formulae to use IF() and ISERROR(). For instance

Code: Select all

=iferror(L18/L19;0)
would be rewritten as

Code: Select all

=IF(ISERROR(L18/L19);0;L18/L19)
Alternatively you may try LibreOffice which does have the IFERROR function.
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.8.3.2; SlackBuild for 24.8.3 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue
Unexpected '{' on line 32
.
User avatar
MrProgrammer
Moderator
Posts: 5099
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Formula from Excel to OO

Post by MrProgrammer »

Mardana wrote: Tue Oct 29, 2024 2:57 am … iserror(--TEXT(--MID($Data.$E$5:$E$2550;FIND(" ";$Data.$E$5:$E$2550)+1;LEN($Data.$E$5:$E$2550));"[mm]");0) …
This part of your Excel monster formula is bogus. FIND takes two parameters. LEN takes one parameter. MID takes three parameters. TEXT takes two parameters. ISERROR takes one parameter but your formula supplies two. I doubt if this is a valid Excel formula. Perhaps Ithe original function in Excel was IFERROR, which does take two parameters. In Excel IFERROR(expression;0) would mean: if the expression returns an error the function result is 0 otherwise it's the expression's value. Others have told you how to do that in OpenOffice.

ISERROR(--TEXT(--MID($Data.$E$5:$E$2550;FIND(" ";$Data.$E$5:$E$2550)+1;LEN($Data.$E$5:$E$2550));"[mm]");0)
                                        FIND(111;222222222222222222)   LEN(111111111111111111)            
                 MID(111111111111111111;222222222222222222222222222222;33333333333333333333333)           
          TEXT(11111111111111111111111111111111111111111111111111111111111111111111111111111111;222222)   
ISERROR(11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111;2)

There may be other problems as well. I decline to attempt to fix the bogus Excel formula. The best way to determine what is wrong with a monster formula is to break it into multiple cells, as many as needed, each of which calls just one or two functions. Then you can examine each cell's formula and value until you find the problem. You will make more work for yourself if, after finding the trouble, you reassemble the monster formula.

FJCC wrote: Tue Oct 29, 2024 3:36 am I can't make any sense out of the second formula you posted.
This does look like other horrid Excel formulas I've seen. Excel considers boolean values to be distinct from numeric values, so numeric operations on booleans like SUM(boolean;boolean) can fail because the values are ignored, and boolean operations on numbers can fail for the same reason. The double negative is used to convert logical values to numeric values. The AND(number;number) operation is written as (number)*(number). These difficulties go away in Calc since boolean FALSE and TRUE are equivalent to 0 and 1. Maybe ‑‑MID and ‑‑TEXT are being used to convert text from those functions to numeric values, though I don't recall seeing this method elsewhere. I would use the VALUE function to make the intent clear.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
keme
Volunteer
Posts: 3738
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Formula from Excel to OO

Post by keme »

There is a problem with your posted "monster formula" structure. It shows 40 "open parenthesis" and only 35 "close parenthesis", and all appear to be part of formula structure (none are quoted). This discrepancy may be caused by a limitation on formula length or nesting depth in your installed version of Calc, or in some other software your file has "visited", which "chopped off" the last part of the formula.

A few suggestions:
  • Can you explain what the formula is supposed to do? A different formula, hopefully also compatible with Excel, may then be devised.
  • Can you share the file, so we can observe the formula "live"?
  • Can you open the file in Excel and copy the offending formula from there?
Mardana
Posts: 8
Joined: Fri Oct 25, 2024 3:38 am

Re: Formula from Excel to OO

Post by Mardana »

keme wrote: Tue Oct 29, 2024 11:44 am There is a problem with your posted "monster formula" structure. It shows 40 "open parenthesis" and only 35 "close parenthesis", and all appear to be part of formula structure (none are quoted). This discrepancy may be caused by a limitation on formula length or nesting depth in your installed version of Calc, or in some other software your file has "visited", which "chopped off" the last part of the formula.

A few suggestions:
  • Can you explain what the formula is supposed to do? A different formula, hopefully also compatible with Excel, may then be devised.
  • Can you share the file, so we can observe the formula "live"?
  • Can you open the file in Excel and copy the offending formula from there?
Attachments
TEST.ods
(54.22 KiB) Downloaded 20 times
Open office 4.1.3
Mardana
Posts: 8
Joined: Fri Oct 25, 2024 3:38 am

Re: Formula from Excel to AOO

Post by Mardana »

We attached for the file as we provide from excel, when we operated in excel there is normal, when we open in OOc, the problem was, #name, after we changed every if error with If(iserror), the result is err:508
Open office 4.1.3
Mardana
Posts: 8
Joined: Fri Oct 25, 2024 3:38 am

Re: Formula from Excel to AOO

Post by Mardana »

Actually the formula which we submit to excel as follow
=iferror(SUMPRODUCT((((--TEXT($B5;"[mm]")<=--TEXT(MOD($Data.$E$5:$E$2550;1);"[mm]"))*(--TEXT($C5;"[mm]")>=--TEXT(MOD($Data.$E$5:$E$2550;1);"[mm]")))*($Data.$E$5:$E$2550<>""))*(Q$4=$Data.$I$5:$I$2550));SUMPRODUCT(((iferror((--TEXT($B5;"[mm]")<=--iferror(--TEXT(--MID($Data.$E$5:$E$2550;FIND(" ";$Data.$E$5:$E$2550)+1;LEN($Data.$E$5:$E$2550));"[mm]");0));0)*iferror((--TEXT($C5;"[mm]")>=--iferror(--TEXT(--MID($Data.$E$5:$E$2550;FIND(" ";$Data.$E$5:$E$2550)+1;LEN($Data.$E$5:$E$2550));"[mm]");0));0)*($Data.$E$5:$E$2550<>""))*(Q$4=$Data.$I$5:$I$2550)))). And the result well done, but when we changed to OO, there is no result, and mismistake. I was follow for the instruction with another person, but the result still not matched.
Open office 4.1.3
Alex1
Volunteer
Posts: 793
Joined: Fri Feb 26, 2010 1:00 pm
Location: Netherlands

Re: Formula from Excel to AOO

Post by Alex1 »

Function names displayed in lowercase are unknown to Calc. LibreOffice Calc does know IFERROR.
D5 contains =IF(Data.E5:E36 <>"", COUNTIFS(Data.E5:E36, ">=" & TIME(2, 0, 0), Data.E5:E36, "<=" & TIME(2, 59, 59), Data.G5:G36, "Airport"), "Data tidak valid")
It contains commas instead of semicolons as separators, which is wrong.
When I open it in Excel I see only a zero, not a formula. Something must have gone wrong with the conversion. Do you have the original XLSX version?
AOO 4.1.15 & LO 24.8.3 on Windows 10
Mardana
Posts: 8
Joined: Fri Oct 25, 2024 3:38 am

Re: Formula from Excel to AOO

Post by Mardana »

hi Alex.
here with we attached the xlsx . Actually when we changed the profil and suburb they Will work
Open office 4.1.3
User avatar
robleyd
Moderator
Posts: 5265
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Formula from Excel to AOO

Post by robleyd »

File is not attached. See How to attach a document for details regarding attaching a document.
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.8.3.2; SlackBuild for 24.8.3 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue
Unexpected '{' on line 32
.
Mardana
Posts: 8
Joined: Fri Oct 25, 2024 3:38 am

Re: Formula from Excel to AOO

Post by Mardana »

robleyd wrote: Fri Nov 01, 2024 3:20 am File is not attached. See How to attach a document for details regarding attaching a document.
Here with we attach the file xlsx
Attachments
TEST.xls
(78 KiB) Downloaded 22 times
Open office 4.1.3
User avatar
Hagar Delest
Moderator
Posts: 32853
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Formula from Excel to AOO

Post by Hagar Delest »

Nothing useful it seems:
Calc_scrshot.png
Calc_scrshot.png (15.65 KiB) Viewed 547 times
LibreOffice 24.8 on Xubuntu 24.10 and 24.8 portable on Windows 10
Alex1
Volunteer
Posts: 793
Joined: Fri Feb 26, 2010 1:00 pm
Location: Netherlands

Re: Formula from Excel to AOO

Post by Alex1 »

This contains mostly errors, and I cannot find anything resembling the formulas you gave. Is this the wrong file?
AOO 4.1.15 & LO 24.8.3 on Windows 10
mikele
Posts: 73
Joined: Wed Nov 21, 2018 11:11 am
Location: Germany

Re: Formula from Excel to AOO

Post by mikele »

Hi,
instead of

Code: Select all

--TEXT($B5;"[mm]")
and

Code: Select all

--TEXT(MOD($Data.$E$5:$E$2550;1);"[mm]")
use

Code: Select all

MINUTE($B5)
and

Code: Select all

MINUTE($Data.$E$5:$E$2550)
LibreOffice 5.4, 7.0, 7.2 on LinuxMint/Win10
User avatar
karolus
Volunteer
Posts: 1199
Joined: Sat Jul 02, 2011 9:47 am

Re: Formula from Excel to AOO

Post by karolus »

mikele wrote: Sun Nov 03, 2024 4:41 pm Hi,
instead of

Code: Select all

--TEXT($B5;"[mm]")
and

Code: Select all

--TEXT(MOD($Data.$E$5:$E$2550;1);"[mm]")
use

Code: Select all

MINUTE($B5)
and

Code: Select all

MINUTE($Data.$E$5:$E$2550)
unfortunatly no, but:

Code: Select all

INT(MOD($B5;1)*1440)
and

Code: Select all

INT(MOD($Data.$E$5:$E$2550;1)*1440)
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 24.8… flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
Post Reply