Extracting a date from a cell which has a particular value

Status
Not open for further replies.

AMIT2179

New Member
Joined
Nov 2, 2011
Messages
43
I have 3 cells in excel in same column. One has value "Dec, 2014", second one has value "NA_Dec'14" and the third one has value "NA_". As you can see 3 cells have 3 different values. I am looking to extract a date either first day of the month or last day of the month from the second cell which has value "NA_Dec'14". So the output should look like either 12/01/14 or 12/31/14 or anyday of the Dec 14. Please can you help.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
What does NA stand for and which day do you want, the first or last?
 
Upvote 0
So, assuming those 3 cells are in A1:A3, does this work for you?

=DATEVALUE("1"&MID(SUBSTITUTE(A2,"'",""),4,5))

If not please give more examples and expected results & any further explanation that you can
 
Upvote 0
Basically, lets assume, B1 has value "Dec, 2014", B2 has value "NA_Dec'14" and B3 has value "NA_". I am looking for a formulae in column C, which gives me a blank or false in C1, date as in last day of Dec 14 in C2 and blank or NA in C3. So when the formulae finds a combination of NA and Month,Year like in B2, the formulae returns a date as in last day of the month specified in cell B2.
 
Upvote 0
In that case try this in C1, copied down

=IFERROR(EOMONTH(MID(SUBSTITUTE(B1,"'",""),4,5),0),"")
 
Upvote 0
Thanks, it surely gives me last day of the month but its giving me year as 2019 in all cases. Please help.
 
Upvote 0
Thanks, it surely gives me last day of the month but its giving me year as 2019 in all cases. Please help.
Ah, must be different regional date settings to me I think. Try this instead.

=IF(AND(LEFT(B1,3)="NA_",LEN(B1)>3),EOMONTH(1&MID(SUBSTITUTE(B1,"'",""),4,5),0),"")
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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