how can I extract the day from a cell

ummjay

Board Regular
Joined
Oct 1, 2010
Messages
193
how can i extract the day from a cell?

i.e. says: "August 13 2014"

I want to extract the day "13" , this cell constantly updates.

thanks!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
hey thanks. if i wanted to is in vba? i want to add it into a string.

Set ReportDay = wbForCopy.Sheets("F&ODaily").Day(A93) shouldnt seem to do it.

any ideas?
 
Upvote 0
Try

Code:
Dim ReportDay As Integer
ReportDay = Day(wbForCopy.Sheets("F&ODaily").Range("A93"))
 
Upvote 0
Try

Code:
Dim ReportDay As Integer
ReportDay = Day(wbForCopy.Sheets("F&ODaily").Range("A93"))
@ummjay,

Just to follow up on Jonmo1's suggestion....

The above code assumes the value in cell A93 on the "F&O Daily" sheet is a real Excel date. I note that because what you posted in Message #1, as shown, is not a real date. Now, it is possible that the cell contains a real Excel date and is only formatted to look the way you show it, in which case Jonmo1's code above will work for you. However, if as I suspect, the cell value is text and is exactly as you posted, then you would need this code line to retrieve the day number from it instead...

Code:
ReportDay = Split(wbForCopy.Sheets("F&ODaily").Range("A93"))(1)
 
Upvote 0
ReportDay = 0

It doesn't appear to be working properly.

A93 is formatted as date: and says:
August 13 2014
 
Upvote 0
This should do it, whether the cell contains text or an excel date
=DAY(DATEVALUE(TEXT(A93,"m/d/yy")))
 
Upvote 0
Just because a cell is 'formatted' as a date, doesn't mean it actually 'contains' a date.

What does this return if you enter it in a cell on the F&ODaily sheet.
=ISNUMBER(A93)
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,492
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top