[Solved] IF function with two date tests

Discuss the spreadsheet application
Post Reply
Canada
Posts: 21
Joined: Mon Jan 07, 2019 3:28 am

[Solved] IF function with two date tests

Post by Canada »

I want to have this function working, but obviously I did something wrong. Any suggestion ?

=IF(E20>=2019-11-27;<=2020-4-30;Q7;0)

Tks in adv.

Gustav


FJCC's formula did the trick. Thank you. And thanks also to all others who replied. Have a nice day.

Gustav
Last edited by robleyd on Mon Jan 20, 2020 11:24 pm, edited 3 times in total.
Reason: Tagged [Solved]
OpenOffice 4.1 on Windows 10
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Calc function

Post by FJCC »

Does this do what you want?

Code: Select all

=IF(AND(E20 >= DATE(2019;11;27); E20 =< DATE(2020;4;30));Q7;0)
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
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Calc function

Post by Villeroy »

2019-11-27 is interpreted as 2019 minus 11 minus 27 which evaluates to 1981
The date function does what you want or the double-quoted string "2019-11-27" but not "27/11/2019" nor "11/27/2019". Only ISO dates "2019-11-27" evaluate to the right day number.

https://xkcd.com/1179/
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: IF function with two date tests

Post by RusselB »

Additionally the OP has an incorrect number of parameters for the IF function. There is the comparator, followed by the True response, followed by the False response, and then an additional parameter.
Calc should've thrown an error due to the incorrect number of parameters.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Post Reply