Recognising text as data

  • Thread starter Thread starter Grayling
  • Start date Start date
G

Grayling

Hi. A2 contains text like this example

"YORK (12 Jun 2004) "

and I extract to a number of P cells the date part ("12
Jun 2004") using

=MID($A$2,FIND("(",$A$2)+1,FIND(")",$A$2)-FIND("(",$A$2)-
1)

The problem for me is that Excel doesn't recognise the P
cell text (that is, e.g. "12 Jun 2004") as a date, so I
can't reformat it into another date format and can't sort
data on the basis of it. Very grateful for any help with
this.

Grayling
 
Hi
try
=--SUBSTITUTE(MID($A$2,FIND("(",$A$2)+1,FIND(")",$A$2)-FIND("(",$A$2)-1
)," ","-")
 
Dates are nothing more than numbers in Excel, so you need
to convert your date string to a number by multiplying
your formula by 1:

=yourformula*1

and then format the cell as date.

HTH
Jason
Atlanta, GA
 
I read in microsoft.public.excel.worksheet.functions that Grayling
Hi. A2 contains text like this example

"YORK (12 Jun 2004) "

and I extract to a number of P cells the date part ("12
Jun 2004") using

=MID($A$2,FIND("(",$A$2)+1,FIND(")",$A$2)-FIND("(",$A$2)-
1)

The problem for me is that Excel doesn't recognise the P
cell text (that is, e.g. "12 Jun 2004") as a date, so I
can't reformat it into another date format and can't sort
data on the basis of it. Very grateful for any help with
this.

I think you need to add the DATE function, otherwise your P cells are
treated as text. Try:

=DATE(MID($A$2,FIND("(",$A$2)+1,FIND(")",$A$2)-FIND("(",$A$2)-1))


II that doesn't work, see if A2 is formatted as Text. I've had problems
with dates recently, but the string functions you are using do work IF
the original data is Text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top