- Search ExcelTip.com
directly from Excel
- Get immediate access to the
"Tip of the Hour"
- View hundreds of Microsoft
Excel tips with a click of a button
- Absolutely
Free - Click
here to download
Make your Amazon.com purchases by clicking the graphic below
|
Excel Tip .com - Mailing List Thread Index
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DATE are odd or EVEN
If you were to use a UDF then this would do..
Function IsEvan(Rng As Date) As Boolean
IsEvan = (Day(Rng) Mod 2 <> 1)
End Function
..on the other hand you could just as easily use a function.
=MOD(DAY(A1),2)=0
Regards Robert
----- Original Message -----
From: "Leroy, Bertrand" <Bertrand.Leroy@RBS.CO.UK>
To: <EXCEL-G@PEACH.EASE.LSOFT.COM>
Sent: Wednesday, July 23, 2003 2:14 AM
Subject: Re: DATE are odd or EVEN
: okay .. I am using excel97 and it seems I can't use that function (ISEVEN)
: ...
: anyway, to check if a number is even , I always divide it by two and
compare
: it's integer part against itself .. like so:
:
: Function isEven() As Boolean
: If CInt(CInt(Day(Range("a1"))) / 2) = CInt(Day(Range("a1"))) / 2 Then
: isEven = True
: Else
: isEven = False
: End If
: End Function
:
: please note that I also CInt the Days(Range("A2")) part to make sure that
: it's not a date but an integer ... not sure if really necessary but it
works
: ...
:
: HTH,
:
: Bertrand
:
: > -----Original Message-----
: > From: Larry E. Havard [SMTP:LarryH@HAVARD.COM]
: > Sent: 22 July 2003 15:06
: > To: EXCEL-G@PEACH.EASE.LSOFT.COM
: > Subject: DATE are odd or EVEN
: >
: > *** WARNING : This message originates from the Internet ***
: >
: > I need a little help
: >
: > Example
: >
: > A32 === 07/22/20003
: >
: >
: >
: > I have a column with a date in it . I am using the Day(A32) to return
the
: > day of the month. I then need to determine if the day is odd or even.
: >
: > If is use DAY(a32) is get 22. Great
: >
: > But if I use ISEVEN(DAY(A32)) I get a #name error??
: >
: >
: > What is what is
: >
: > IF(ISEVEN(DAY(A32)),"EVEN","ODD")
: >
: > Can anyone tell me why that will not work?
: >
: >
: > Thanks
: >
: >
: >
: > Larry E. Havard
: > HAVARD
: > & ASSOCIATES
: > 741-B Kenmoor SE
: > Grand Rapids, MI 49546
: > Voice (616) 458 9333
: > Fax (801) 340 7800
--------------------------------------------------------------------------
The EXCEL-G list is hosted on a Windows NT(TM) machine running L-Soft
international's LISTSERV(R) software. For subscription/signoff info
and archives, see http://peach.ease.lsoft.com/archives/excel-g.html .
COPYRIGHT INFO:
http://peach.ease.lsoft.com/scripts/wa.exe?SHOWTPL=COPYRIGHT&L=EXCEL-G
|
And at your local bookseller


Excel Training Level I
Excel
Training Level II
Excel
Training Level III
Excel
VBA Training Level I
Excel
VBA Training Level II
View All Excel Training Programs

Formula Manager
Duplication
Manager
Text
Manager
Number
Manager
Add-ins
Collection
Spreadsheet
Assistant
Number
Manager
Add-ins
Collection
Spreadsheet
Assistant
View All Excel Add-Ins
|