[Solved] IF function with two date tests

Discuss the spreadsheet application

[Solved] IF function with two date tests

Postby Canada » Mon Jan 20, 2020 3:14 pm

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
Canada
 
Posts: 8
Joined: Mon Jan 07, 2019 3:28 am

Re: Calc function

Postby FJCC » Mon Jan 20, 2020 4:08 pm

Does this do what you want?
Code: Select all   Expand viewCollapse view
=IF(AND(E20 >= DATE(2019;11;27); E20 =< DATE(2020;4;30));Q7;0)
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7751
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Calc function

Postby Villeroy » Mon Jan 20, 2020 5:42 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28559
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: IF function with two date tests

Postby RusselB » Mon Jan 20, 2020 6:10 pm

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 and LibreOffice 6.3.3.2 on Windows 7 Pro & Ultimate
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.
User avatar
RusselB
Moderator
 
Posts: 6117
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON


Return to Calc

Who is online

Users browsing this forum: No registered users and 15 guests