ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   datePart Function (https://www.excelbanter.com/excel-programming/386717-datepart-function.html)

Carlee

datePart Function
 
Hi there,

Is there DatePart function, like that found in MS Access, which enables me
to separate day, month and year, filtering then, on specific parts of a date?
--
Carlee

Brent

datePart Function
 
=TEXT(cell name containing date,"dddd")

use "mmm" for abbrev. month name
use "yyyy" for year

I think this will work for what you want.

Brent


"Carlee" wrote:

Hi there,

Is there DatePart function, like that found in MS Access, which enables me
to separate day, month and year, filtering then, on specific parts of a date?
--
Carlee


Vergel Adriano

datePart Function
 
Hi Carlee,

The DatePart function is available in Excel VBA.

Sub test()
Dim iDay As Integer
Dim iYear As Integer
Dim iMonth As Integer

iYear = DatePart("yyyy", Now)
iMonth = DatePart("m", Now)
iDay = DatePart("d", Now)

'or you can also use:
iYear = Year(Now)
iMonth = Month(Now)
iDay = Day(Now)

End Sub



--
Hope that helps.

Vergel Adriano


"Carlee" wrote:

Hi there,

Is there DatePart function, like that found in MS Access, which enables me
to separate day, month and year, filtering then, on specific parts of a date?
--
Carlee



All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com