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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Does this work for you as a formula on the spreadsheet?

=DAY(SUBSTITUTE(A93," ",", ",2))

If not, are the quotation marks actually in the cell?
 
Upvote 0
Scott/Mike,
Both solutions work, thanks.

how can i add these into my VBA. I want to set that value as a string.

i.e
ReportDay = (the day given by that formula).

Also, i want to use A93, using the workbook Report.
Code:
Set Report = ActiveWorkbook
ReportDay = Day(Substitute(Report.Worksheets(1).Range("A93"), " ", ", ", 2))

or

ReportDay = TRIM(MID(SUBSTITUTE(Report.Worksheets(1).Range("A93")," ",REPT(" ",255)),255,255))

How can i do that?

thanks again.
 
Upvote 0
Code:
ReportDay = Day(Application.WorksheetFunction.Substitute(Report.Worksheets(1).Range("A93"), " ", ", ", 2))
 
Upvote 0
that's awesome scott, that did it.

if I wanted to search a range from B8-K19, for the string ReportDay, and add a value in 2 cells below that cell containing the string, would you happen to know how to do that?

i.e I have a calendar , each cell only has the day, then i have 2 cells beneath each of them.
I want to .PasteSpecial xlPasteValuesAndNumberFormats in the 2nd cell beneath the cell where the string is located.

how can i accomplish this?

thanks!!
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,844
Members
449,411
Latest member
adunn_23

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