View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default formula for adding a date

If you type a formula like this into an empty cell:

=len(a1)
(change A1 to the cell's address that contains the yyyy mm)

What's returned?

If you type this formula that empty cell:
=code(mid(a1,5,1))
what do you see?

If you don't see 7 for the first formula and 32 for the second, then the value
in that cell isn't what I thought it would be--plain old text like 2007 08

Any correct formula will need to know what you really have in those cells.

Dslady wrote:

I have tried both of these and can't seem to get them to work. On the short
version I keep getting a message that a value is of the wrong data type.

"Dave Peterson" wrote:

This shorter version worked, too:

=TEXT((SUBSTITUTE(A1," ","/")&"/01")+31,"yyyy mm")



Dave Peterson wrote:

This worked for me:
=TEXT(DATEVALUE(SUBSTITUTE(A1," ","/")&"/01")+31,"yyyy mm")

Dslady wrote:

I have a four digit space 2 digit cell example (yyyy mm) and I need to ad one
to the month. Is there a way fo doing this?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson