I have data Imported into cells from another program. The data is a date,
and it comes into the cell as follows:
April, 2006 = 406
December, 2006 = 1206
etc, etc...
Now, I want to format the cells such that they change to
Apr-06
Dec-06
I have been messing around trying to figure out a custom format, and have
had no luck. What am I missing? Ultimately I'll incorporate this into a
macro, SO, if there are some CODE solutions, bring em on. THANKS!!!!!!!
I think I this conversion may not be so tough to make.
First we peel off the first three characters simply by using the
=LEFT() function, then store that in an adjacent cell. Then peel off
the quot;06quot; part by using the =RIGHT() function and store that in another
cell. Then use the CONCATENATE function to join the contents of the
first cell, plus a dash, plus the contents of the second cell.
Taking it a notch further, you can nest the RIGHT and LEFT functions
within the CONCATENATE function, and not have to store those substrings
at all.
-Dan--
vthoky
------------------------------------------------------------------------
vthoky's Profile: www.excelforum.com/member.php...oamp;userid=34607
View this thread: www.excelforum.com/showthread...hreadid=543784I'm guessing that your dates were imported as Text fields, rather than dates.
Thus, no matter what Date Format you apply, you won't see any changes. This
should be identifiable by an apostrophe at the beginning of each date that is
only visible in the Formula Bar, not the cell.
Follow these steps to remove the apostrophes.
Enter a 1 into any blank cell.
Copy that cell.
Select your range of dates.
Paste Special
Check the box called quot;Multiplyquot;
Click OK
Delete the 1 you entered originally.
Now, try applying your desired Date Format and see if it works.
HTH,
Elkarquot;bodhisatvaofboogiequot; wrote:
gt; I have data Imported into cells from another program. The data is a date,
gt; and it comes into the cell as follows:
gt;
gt; April, 2006 = 406
gt; December, 2006 = 1206
gt; etc, etc...
gt;
gt; Now, I want to format the cells such that they change to
gt;
gt; Apr-06
gt; Dec-06
gt;
gt; I have been messing around trying to figure out a custom format, and have
gt; had no luck. What am I missing? Ultimately I'll incorporate this into a
gt; macro, SO, if there are some CODE solutions, bring em on. THANKS!!!!!!!
The Concatenate function doesn not allow it to format into mmyy. Or perhaps
I am doing something wrong.
quot;vthokyquot; wrote:
gt;
gt; I think I this conversion may not be so tough to make.
gt;
gt; First we peel off the first three characters simply by using the
gt; =LEFT() function, then store that in an adjacent cell. Then peel off
gt; the quot;06quot; part by using the =RIGHT() function and store that in another
gt; cell. Then use the CONCATENATE function to join the contents of the
gt; first cell, plus a dash, plus the contents of the second cell.
gt;
gt; Taking it a notch further, you can nest the RIGHT and LEFT functions
gt; within the CONCATENATE function, and not have to store those substrings
gt; at all.
gt;
gt; -Dan
gt;
gt;
gt; --
gt; vthoky
gt; ------------------------------------------------------------------------
gt; vthoky's Profile: www.excelforum.com/member.php...oamp;userid=34607
gt; View this thread: www.excelforum.com/showthread...hreadid=543784
gt;
gt;
Perhaps I misunderstood. In your last message you mention mmyy format,
but in the original one your example was Apr-06. I was using that
format for the example I gave you. Assuming the value quot;April, 2006quot;
was in cell D3, the formula I put in F3 was
=CONCATENATE((LEFT(D3,3)),quot;-quot;,(RIGHT(D3,2)))
If you want to go to the mmyy format, then we have some more work to
do. Getting the yy portion is easy. Having Excel determine the month
name from the given text is what we need to do next. Once we have
that, then it's back to the Concatenate statement and all is well.
Please let me know if that's what you're looking for, and I'll see if I
can make it work.
-Dan--
vthoky
------------------------------------------------------------------------
vthoky's Profile: www.excelforum.com/member.php...oamp;userid=34607
View this thread: www.excelforum.com/showthread...hreadid=543784What was originally in the cells after the import is the single numbers, the
406 which stands for April 2006. BUT it is just listed as 406. I want to
convert that 406 into Apr-06 That is my ideal solution
Example:
In Cell Want it to become
406 Apr-06
1205 Dec-05
etc.....
quot;vthokyquot; wrote:
gt;
gt; Perhaps I misunderstood. In your last message you mention mmyy format,
gt; but in the original one your example was Apr-06. I was using that
gt; format for the example I gave you. Assuming the value quot;April, 2006quot;
gt; was in cell D3, the formula I put in F3 was
gt; =CONCATENATE((LEFT(D3,3)),quot;-quot;,(RIGHT(D3,2)))
gt;
gt; If you want to go to the mmyy format, then we have some more work to
gt; do. Getting the yy portion is easy. Having Excel determine the month
gt; name from the given text is what we need to do next. Once we have
gt; that, then it's back to the Concatenate statement and all is well.
gt; Please let me know if that's what you're looking for, and I'll see if I
gt; can make it work.
gt;
gt; -Dan
gt;
gt;
gt; --
gt; vthoky
gt; ------------------------------------------------------------------------
gt; vthoky's Profile: www.excelforum.com/member.php...oamp;userid=34607
gt; View this thread: www.excelforum.com/showthread...hreadid=543784
gt;
gt;
I'm to take it my solution didn't work? But, here's another idea, using a
second column enter this formula:
=TEXT(A1,quot;mmm-yyquot;)
HTH,
Elkarquot;bodhisatvaofboogiequot; wrote:
gt; What was originally in the cells after the import is the single numbers, the
gt; 406 which stands for April 2006. BUT it is just listed as 406. I want to
gt; convert that 406 into Apr-06 That is my ideal solution
gt;
gt; Example:
gt;
gt; In Cell Want it to become
gt; 406 Apr-06
gt; 1205 Dec-05
gt;
gt; etc.....
gt;
gt;
gt;
gt; quot;vthokyquot; wrote:
gt;
gt; gt;
gt; gt; Perhaps I misunderstood. In your last message you mention mmyy format,
gt; gt; but in the original one your example was Apr-06. I was using that
gt; gt; format for the example I gave you. Assuming the value quot;April, 2006quot;
gt; gt; was in cell D3, the formula I put in F3 was
gt; gt; =CONCATENATE((LEFT(D3,3)),quot;-quot;,(RIGHT(D3,2)))
gt; gt;
gt; gt; If you want to go to the mmyy format, then we have some more work to
gt; gt; do. Getting the yy portion is easy. Having Excel determine the month
gt; gt; name from the given text is what we need to do next. Once we have
gt; gt; that, then it's back to the Concatenate statement and all is well.
gt; gt; Please let me know if that's what you're looking for, and I'll see if I
gt; gt; can make it work.
gt; gt;
gt; gt; -Dan
gt; gt;
gt; gt;
gt; gt; --
gt; gt; vthoky
gt; gt; ------------------------------------------------------------------------
gt; gt; vthoky's Profile: www.excelforum.com/member.php...oamp;userid=34607
gt; gt; View this thread: www.excelforum.com/showthread...hreadid=543784
gt; gt;
gt; gt;
Sorry, I misunderstood.
Here's my example:
* In cells F14 through F12 input the values 106, 206, ..., 1206
* In cells J1=J12 I have the numbers 1 through 12
* In cells K1 through K12 I have the three-character month names (Jan,
Feb, etc.)
* In cell G14 I have =LEFT(F14,LEN(F14)-2). This gives us the month
number.
* In cell H14 I have =LOOKUP(1,J$1:J$12,K$1:K$12). This refers to the
table in J1:K12 for lookup values.
* In cell I14 I have =CONCATENATE(H14,quot;-quot;,(RIGHT(F14,2))). Copy this
cell down through I25. This cell gathers the month number (derived in
H14) plus the hyphen, plus the last two digits in the original field
(the year number) and puts them all together into your desired format.
The formulas in Cells H15-H25 will be like the one in H14, except
they'll start with =LOOKUP(2,... then =LOOKUP(3,... and so forth
through =LOOKUP(12,... .
It's sort of big-hammer, but it works.
I'd be glad to email you the file if you'd like.
-Dan--
vthoky
------------------------------------------------------------------------
vthoky's Profile: www.excelforum.com/member.php...oamp;userid=34607
View this thread: www.excelforum.com/showthread...hreadid=543784
- Jan 24 Wed 2007 20:35
Format Cell Question
close
全站熱搜
留言列表
發表留言