[Solved] IFERROR() help

Discuss the spreadsheet application
Post Reply
Deepak chawla
Posts: 7
Joined: Tue Nov 22, 2016 8:18 am

[Solved] IFERROR() help

Post by Deepak chawla »

Hi
If in A6, B6, C6 there is a date, how can we calc and get the days from using formula
=IF(iferror(datedif(C6;D6;"D");0)=0;datedif(C6;B6;"D");datedif(C6;D6;"D"))

i tried on open office but getting error

Please help
Last edited by Hagar Delest on Wed Nov 23, 2016 2:43 pm, edited 1 time in total.
Reason: tagged [Solved].
Apache OpenOffice 4.1.2
rajew
Posts: 27
Joined: Sun Oct 23, 2016 1:42 pm

Re: iferror

Post by rajew »

Hey,

In AOO calc there are no IFERROR and DATEDIF functions, hence You get the #NAME? error probably.
To get the same behaviour from a Calc formula You would have to use something like:

Code: Select all

=IF((IF(ISERROR(DAYS(C6;D6));0;DAYS(C6;D6))=0);DAYS(C6;B6);DAYS(C6;D6))
OpenOffice 4.1.3 on Windows 10 x64
Deepak chawla
Posts: 7
Joined: Tue Nov 22, 2016 8:18 am

Re: iferror

Post by Deepak chawla »

PLEASE FIND BELOW EXAMPLE

Code: Select all

      (A)            (B)            (C)                (D)
CURRENT DATE      OTHER DATE       DATE            RESULT
22-Nov-16            10-Nov-16      11-Nov-16          1
22-Nov-16            15-Oct-16                        42658
22-Nov-16            20-Oct-16                       -42663
While using formula i am get result in first row but not it rest row
=IF((IF(ISERROR(DAYS(D7;C7));0;DAYS(D7;C7))=0);DAYS(C7;B7);DAYS(D7;C7))

I need to get days if there is data in (C) means (C)-(B) else days from (B) - (A)
Last edited by RoryOF on Tue Nov 22, 2016 12:50 pm, edited 3 times in total.
Reason: added [Code] tags for better table layout [RoryOF, Moderator]
Apache OpenOffice 4.1.2
User avatar
floris v
Volunteer
Posts: 4431
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: iferror

Post by floris v »

Please tell us what you want to achieve, in English; forget the math.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
rajew
Posts: 27
Joined: Sun Oct 23, 2016 1:42 pm

Re: iferror

Post by rajew »

Deepak chawla wrote:I need to get days if there is data in (C) means (C)-(B) else days from (B) - (A)
Well, based on that I would say something like:

Code: Select all

=ABS(IF($C7="";DAYS($B7;$A7);DAYS($C7;$B7)))
should be enough, if You only have a date or nothing in the C column. This will return the number of days between either A and B or B and C, if there is anything in the C column.
You can drop the ABS part if You want to see negative numbers aswell, so:

Code: Select all

=IF($C7="";DAYS($B7;$A7);DAYS($C7;$B7))
If for some unholy reason You really need to check if the formula would produce an error You could go with:

Code: Select all

=IF(ISBLANK($C6)OR(ISERROR(DAYS($C6;$B6)));DAYS(B6;A6);DAYS(C6;B6))
OpenOffice 4.1.3 on Windows 10 x64
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: iferror

Post by Lupp »

(DATEDIF is just one of the many useless functions commercial competitors introduced.)

Please attach your examples included in a reduced but relevant ("speaking") spreadsheet document (.ods). It should also contain (clearly marked) the results you expect and the formulae you already tried without success. Otherwise helpers will have to waste some time to simply understand you, and get at the start.

The orgiginal question already contains a grave inconsistency, imo. The result seems to be expected in column D but the formula given to explain the intentions references the cell expected to contain the result twice. A circular reference surely doesn't make sense in this context.

The most recent explanation refers to differences that will be negative in two rows based on the given examples. I would suggest you clearly tell us if this is what you want. In addition the condition for using the first mentioned difference now is
Deepak chawla wrote:...if there is data in (C)...
I suppose you expect the "data" to be numeric and interpreted as a date.

See attached.
Attachments
aoo86158ConditionalNumberOfDaysPassed_1.ods
(12.67 KiB) Downloaded 145 times
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Deepak chawla
Posts: 7
Joined: Tue Nov 22, 2016 8:18 am

Re: iferror

Post by Deepak chawla »

thanks LUPP!
Its working
Apache OpenOffice 4.1.2
Deepak chawla
Posts: 7
Joined: Tue Nov 22, 2016 8:18 am

Re: [Solved] IFERROR() help

Post by Deepak chawla »

(A) (B) (C) (D)
CURRENT DATE SALE DATE BILL DATE AGEING
21-Nov-17 10-Nov-17 01-Nov-17 SOLD
21-Nov-17 01-Nov-17 -20
21-Nov-17 01-Nov-17 -20
Apache OpenOffice 4.1.2
Deepak chawla
Posts: 7
Joined: Tue Nov 22, 2016 8:18 am

Re: [Solved] IFERROR() help

Post by Deepak chawla »

Hi,
I need the stock Ageing report in open office
If in column A contains Current Date, B Contains Sale Date, C contains Bill Date, In D i need Stock Ageing number of days stock kept. If in case sold then In Column B to insert the date and print in D SOLD
Apache OpenOffice 4.1.2
Post Reply