desktop-packages team mailing list archive
-
desktop-packages team
-
Mailing list archive
-
Message #16392
[Bug 654161] Re: Nested IF malfunction when used with WEEKDAY function
** Changed in: openoffice.org (Ubuntu)
Status: Opinion => Won't Fix
--
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to libreoffice in Ubuntu.
https://bugs.launchpad.net/bugs/654161
Title:
Nested IF malfunction when used with WEEKDAY function
Status in “gnumeric” package in Ubuntu:
Opinion
Status in “libreoffice” package in Ubuntu:
Opinion
Status in “openoffice.org” package in Ubuntu:
Won't Fix
Bug description:
Binary package hint: openoffice.org
The following Calc formula appears to have malfunctioned.
=IF(WEEKDAY(B24,2)=7,"Sunday",(IF(WEEKDAY(B24,2)=1,"Monday",(IF(WEEKDAY(B24,2)=2,"Tuesday",(IF(WEEKDAY(B24,2)=3,"Wednesday",(IF(WEEKDAY(B24,2)=4,"Thursday",(IF(WEEKDAY(B24,2)=5,"Friday",(IF(WEEKDAY(B24,2)=6,"Saturday","...")))))))))))))
I shall refer to this formula as the Saturday Formula.
What is expected to happen:
The formula should return the name of the day corresponding with the
results of the WEEKDAY function applied to Cell B24. So if B24 has the
date "3 Oct 2010", the WEEKDAY (applied using the Type value 2)
function will return the value 7 and the formula will display the
value "Sunday".
The IF function has been nested with each day of the week, so that if
the first weekday value is not found, it looks for the second and so
on until it has checked for all seven days of the week. If none of the
days of the week are found (if, for example, Cell B24 is blank), then
it should display the value "...".
What actually happens:
The formula displays the correct day for every day of the week. But if
Cell B24 does not contain a date (for example, if it is blank) it
displays the word "Saturday".
Further explanation:
The same problem does not occur if the "IF(WEEKDAY..." function is
nested only 5 times. So the following formula, which I shall refer to
as the Friday Formula, works correctly:
=IF(WEEKDAY(B24,2)=7,"Sunday",(IF(WEEKDAY(B24,2)=1,"Monday",(IF(WEEKDAY(B24,2)=2,"Tuesday",(IF(WEEKDAY(B24,2)=3,"Wednesday",(IF(WEEKDAY(B24,2)=4,"Thursday",(IF(WEEKDAY(B24,2)=5,"Friday","...")))))))))))
The Friday Formula correctly displays "..." if none of its nested IF
functions are satisfied. The only significant difference it has to the
Saturday Formula is one less IF function.
I was unable to repeat the malfunction by nesting a plain IF, nor by
nesting an IF using the DAY function. So the following formula, which
contains the same number of IF's as the Saturday formula, correctly
delivers "..." if none of its IF functions are satisfied.
=IF(B1=1,"ONE",(IF(B1=2,"TWO",(IF(B1=3,"THREE",(IF(B1=4,"FOUR",(IF(B1=5,"FIVE",(IF(B1=6,"SIX",(IF(B1=7,"SEVEN","...")))))))))))))
(Reffering to Cell B1 in this formula for no other reason than this is
where it was looking for a date).
The following formula, which also has the same number of IFs as the
Saturday Formula, also correctly delivers "..." if none of its nested
IFs are satisfied:
=IF(DAY(B1)=1,"ONE",(IF(DAY(B1)=2,"TWO",(IF(DAY(B1)=3,"THREE",(IF(DAY(B1)=4,"FOUR",(IF(DAY(B1)=5,"FIVE",(IF(DAY(B1)=6,"SIX",(IF(DAY(B1)=7,"SEVEN","...")))))))))))))
Note that its use of the DAY function seems to indicate that the
problem is related to the nesting of the WEEKDAY function.
ProblemType: Bug
Architecture: i386
Date: Sun Oct 3 16:42:01 2010
DistroRelease: Ubuntu 9.10
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
Package: openoffice.org-core 1:3.1.1-5ubuntu1.2
ProcEnviron:
PATH=(custom, no user)
LANG=en_GB.UTF-8
SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-22.65-generic
SourcePackage: openoffice.org
Uname: Linux 2.6.31-22-generic i686
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnumeric/+bug/654161/+subscriptions