#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default Formula error

Hi,

I was just trying to create a formula to automatically calculates the date
from the pasted in value, example: Oct 22 2008 02:33 pm

Considering the value is in cell B2, I'm using the following formula to
extract the value to compose the date:
=Date(mid(B2,8,4),Match(Left(B2,3),E1:E12,F1:F12), mid(B2,5,2))

Noticed that there is a Match function in the formula, as I understand that
text is not auto recognised for value of month. A reference table is prepared
to match the text extracted:
E F
1 Jan 1
2 Feb 2
3 Mar 3
4 Apr 4
5 May 5
6 Jun 6
7 Jul 7
8 Aug 8
9 Sep 9
10 Oct 10
11 Nov 11
12 Dec 12

The outcome from formula will give me the date 22 Aug 2008, which the month
is wrong.

Further testing shows that extracted value by Left(B2,3) gives 10, but when
used in Match(Left(B2,3),E1:E12,F1:F12), the value returned is 8.

Why is it so?
Is there anyway to correct it?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,358
Default Formula error

Instead of using the MATCH function, instead, try this for the month portion
--TEXT(LEFT(B2,3)&" 1, 2000","m")

Hope this helps.
--
** John C **

"Jacky" wrote:

Hi,

I was just trying to create a formula to automatically calculates the date
from the pasted in value, example: Oct 22 2008 02:33 pm

Considering the value is in cell B2, I'm using the following formula to
extract the value to compose the date:
=Date(mid(B2,8,4),Match(Left(B2,3),E1:E12,F1:F12), mid(B2,5,2))

Noticed that there is a Match function in the formula, as I understand that
text is not auto recognised for value of month. A reference table is prepared
to match the text extracted:
E F
1 Jan 1
2 Feb 2
3 Mar 3
4 Apr 4
5 May 5
6 Jun 6
7 Jul 7
8 Aug 8
9 Sep 9
10 Oct 10
11 Nov 11
12 Dec 12

The outcome from formula will give me the date 22 Aug 2008, which the month
is wrong.

Further testing shows that extracted value by Left(B2,3) gives 10, but when
used in Match(Left(B2,3),E1:E12,F1:F12), the value returned is 8.

Why is it so?
Is there anyway to correct it?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default Formula error

Use
=MATCH(LEFT(B2,3),E1:E12,0)

Third parameter should be 0 for exact match.


"Jacky" wrote:

Hi,

I was just trying to create a formula to automatically calculates the date
from the pasted in value, example: Oct 22 2008 02:33 pm

Considering the value is in cell B2, I'm using the following formula to
extract the value to compose the date:
=Date(mid(B2,8,4),Match(Left(B2,3),E1:E12,F1:F12), mid(B2,5,2))

Noticed that there is a Match function in the formula, as I understand that
text is not auto recognised for value of month. A reference table is prepared
to match the text extracted:
E F
1 Jan 1
2 Feb 2
3 Mar 3
4 Apr 4
5 May 5
6 Jun 6
7 Jul 7
8 Aug 8
9 Sep 9
10 Oct 10
11 Nov 11
12 Dec 12

The outcome from formula will give me the date 22 Aug 2008, which the month
is wrong.

Further testing shows that extracted value by Left(B2,3) gives 10, but when
used in Match(Left(B2,3),E1:E12,F1:F12), the value returned is 8.

Why is it so?
Is there anyway to correct it?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Formula error

Another one:

=DATE(MID(B2,8,4),MONTH(LEFT(B2,3)&1),MID(B2,5,2))

If the year is *always* 2008 and the day is *always* in 00 format:

=DATEVALUE(LEFT(B2,6))

Format as Date


--
Biff
Microsoft Excel MVP


"Jacky" wrote in message
...
Hi,

I was just trying to create a formula to automatically calculates the date
from the pasted in value, example: Oct 22 2008 02:33 pm

Considering the value is in cell B2, I'm using the following formula to
extract the value to compose the date:
=Date(mid(B2,8,4),Match(Left(B2,3),E1:E12,F1:F12), mid(B2,5,2))

Noticed that there is a Match function in the formula, as I understand
that
text is not auto recognised for value of month. A reference table is
prepared
to match the text extracted:
E F
1 Jan 1
2 Feb 2
3 Mar 3
4 Apr 4
5 May 5
6 Jun 6
7 Jul 7
8 Aug 8
9 Sep 9
10 Oct 10
11 Nov 11
12 Dec 12

The outcome from formula will give me the date 22 Aug 2008, which the
month
is wrong.

Further testing shows that extracted value by Left(B2,3) gives 10, but
when
used in Match(Left(B2,3),E1:E12,F1:F12), the value returned is 8.

Why is it so?
Is there anyway to correct it?



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Formula error

If the year is *always* 2008

That should be:

If the year is *always* the current year...

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
Another one:

=DATE(MID(B2,8,4),MONTH(LEFT(B2,3)&1),MID(B2,5,2))

If the year is *always* 2008 and the day is *always* in 00 format:

=DATEVALUE(LEFT(B2,6))

Format as Date


--
Biff
Microsoft Excel MVP


"Jacky" wrote in message
...
Hi,

I was just trying to create a formula to automatically calculates the
date
from the pasted in value, example: Oct 22 2008 02:33 pm

Considering the value is in cell B2, I'm using the following formula to
extract the value to compose the date:
=Date(mid(B2,8,4),Match(Left(B2,3),E1:E12,F1:F12), mid(B2,5,2))

Noticed that there is a Match function in the formula, as I understand
that
text is not auto recognised for value of month. A reference table is
prepared
to match the text extracted:
E F
1 Jan 1
2 Feb 2
3 Mar 3
4 Apr 4
5 May 5
6 Jun 6
7 Jul 7
8 Aug 8
9 Sep 9
10 Oct 10
11 Nov 11
12 Dec 12

The outcome from formula will give me the date 22 Aug 2008, which the
month
is wrong.

Further testing shows that extracted value by Left(B2,3) gives 10, but
when
used in Match(Left(B2,3),E1:E12,F1:F12), the value returned is 8.

Why is it so?
Is there anyway to correct it?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF Formula Error Teri Excel Worksheet Functions 2 July 15th 08 07:32 PM
Formula error Shu of AZ Excel Discussion (Misc queries) 14 July 3rd 08 10:26 PM
Formula Error El Bee Excel Worksheet Functions 5 December 10th 06 05:45 AM
How do I replace "#N/A" error, to continue my formula w/o error? Ali Khan Excel Worksheet Functions 2 February 20th 06 03:49 PM
Formula Error Mike R Excel Discussion (Misc queries) 6 January 15th 05 05:27 AM


All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"