• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to format dates.

Eloise T

Active Member
How do you format the dates in column G
so they all look like G1-G4 and G25-G28
and not like column H?

Please see attachment. Thank you.
 

Attachments

  • Chandoo - date question.xlsx
    9.8 KB · Views: 10
Click and highlight all the cells you want to format, go to the NUMBERS block on the Home tab, click the down arrow until you get the dialog box. Click "CUSTOM" then you can type the format into the blank box at the top under TYPE:. I usually like my dates to look formal (i.e. 01/01/2016). to get this, type mm/dd/yyyy. You can use this for any format. If you want to delete the "0" in from of the month and day and want two digit year then type m/d/yy. There are also examples you can choose from if you scroll down the list. It has dates with times, dates with day of the week, etc.
 
Click and highlight all the cells you want to format, go to the NUMBERS block on the Home tab, click the down arrow until you get the dialog box. Click "CUSTOM" then you can type the format into the blank box at the top under TYPE:. I usually like my dates to look formal (i.e. 01/01/2016). to get this, type mm/dd/yyyy. You can use this for any format. If you want to delete the "0" in from of the month and day and want two digit year then type m/d/yy. There are also examples you can choose from if you scroll down the list. It has dates with times, dates with day of the week, etc.
...Format the dates in column G so they all look like G1-G4 and G25-G28 and not like column H?
 
1) Select G5:G24
2) Go to [TextToColumns] and hit [Next] [Next]
3) Choose [Date] and [MYD] from the list then [Finish]

Should give you what you want.
 
Hi Eloïse !

When a date is a real one (as number, not text like G5-G24),
you just have to format cell back to General

If you test on an empty column, no issue …
But your column H has one, so the question how dates were populated ?

Anyway, for both columns G & H, jindon already gave you the path !
 
Hi Eloïse !

When a date is a real one (as number, not text like G5-G24),
you just have to format cell back to General

If you test on an empty column, no issue …
But your column H has one? one what?, so the question how dates were populated ? Dates in Column H were copied and pasted.
There is a formula under Column G5: ...and down...
=IF(H5<>"N/A",H5,IF(H6<>"N/A",H6,IF(H7<>"N/A",H7,IF(H8<>"N/A",H8,IF(H9<>"N/A",H9,IF(H10<>"N/A",H10,IF(H11<>"N/A",H11,IF(H12<>"N/A",H12,IF(H13<>"N/A",H13,H14)))))))))


Anyway, for both columns G & H, jindon already gave you the path !
 
1) Select G5:G24
2) Go to [TextToColumns] and hit [Next] [Next]
3) Choose [Date] and [MYD] from the list then [Finish]

Should give you what you want.
Please check the attachment as some worked and some didn't.
 

Attachments

  • Chandoo - date question.xlsx
    10.8 KB · Views: 11
Hi Eloïse !

When a date is a real one (as number, not text like G5-G24),
you just have to format cell back to General

If you test on an empty column, no issue …
But your column H has one, so the question how dates were populated ?

Anyway, for both columns G & H, jindon already gave you the path !
Please see my reply to jindon. Thanks.
 
Do you want to keep the formula intact?

If no, just copy the questioned range and paste as Value and then follow the step I have already posted.

Select MDY instead of DMY.
 
=IFERROR(INT(IF(H4<>"N/A",H4,IF(H5<>"N/A",H5,IF(H6<>"N/A",H6,IF(H7<>"N/A",H7,IF(H8<>"N/A",H8,IF(H9<>"N/A",H9,IF(H10<>"N/A",H10,IF(H11<>"N/A",H11,IF(H12<>"N/A",H12,H13)))))))))),DATE(RIGHT(H4,4),LEFT(H4,2),MID(H4,4,2)))
 
=IFERROR(INT(IF(H4<>"N/A",H4,IF(H5<>"N/A",H5,IF(H6<>"N/A",H6,IF(H7<>"N/A",H7,IF(H8<>"N/A",H8,IF(H9<>"N/A",H9,IF(H10<>"N/A",H10,IF(H11<>"N/A",H11,IF(H12<>"N/A",H12,H13)))))))))),DATE(RIGHT(H4,4),LEFT(H4,2),MID(H4,4,2)))
THANK YOU!
 
=IFERROR(INT(IF(H4<>"N/A",H4,IF(H5<>"N/A",H5,IF(H6<>"N/A",H6,IF(H7<>"N/A",H7,IF(H8<>"N/A",H8,IF(H9<>"N/A",H9,IF(H10<>"N/A",H10,IF(H11<>"N/A",H11,IF(H12<>"N/A",H12,H13)))))))))),DATE(RIGHT(H4,4),LEFT(H4,2),MID(H4,4,2)))
I spoke too soon. Your formula changed the dates to numerical numbers (good), but it seemed to nullify the elimination of the N/A text which was the original formula. Any suggestions?
 
I'm not good at formulas, so not really sure if this is right...

=IFERROR(INT(INDEX(H1:H10,MIN(NOT(ISERROR(H1:H10)),ROW(H1:H10)),)),DATE(RIGHT(INDEX(H1:H10,MIN(NOT(ISERROR(H1:H10)),ROW(H1:H10)),),4),LEFT(INDEX(H1:H10,MIN(NOT(ISERROR(H1:H10)),ROW(H1:H10)),),2),MID(INDEX(H1:H10,MIN(NOT(ISERROR(H1:H10)),ROW(H1:H10)),),4,2)))
 
G1:
=IFERROR(INT(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),)),DATE(RIGHT(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),),4),LEFT(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),),2),MID(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),),4,2)))

Confirm with Ctrl + Shift + Enter (Array formula entry)
then copy down...

Hope this works
 
See F9 to F11 in the enclosed attachment.
The formula needs to convert N/A to the closest date either up or down, hence the original formula. Thanks.
 

Attachments

  • Chandoo - jindon date question.xlsx
    10.5 KB · Views: 1
G1:
=IFERROR(INT(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),)),DATE(RIGHT(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),),4),LEFT(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),),2),MID(INDEX(H$1:H$21,MIN(IF(NOT(ISERROR(H1:H$21)),ROW(H1:H$21))),),4,2)))

Confirm with Ctrl + Shift + Enter (Array formula entry)
then copy down...

Hope this works
See attachment with updated formula. It appears to be the same result. The N/As are not resolved. I appreciate your efforts.
 

Attachments

  • Chandoo - jindon date question.xlsx
    10.9 KB · Views: 3
So, it is not really an Error, just "N/A"...

=IFERROR(INT(INDEX(G$1:G$21,MIN(IF(G1:G$21<>"N/A",ROW(G1:G$21))),)),DATE(RIGHT(INDEX(G$1:G$21,MIN(IF(G1:G$21<>"N/A",ROW(G1:G$21))),),4),LEFT(INDEX(G$1:G$21,MIN(IF(G1:G$21<>"N/A",ROW(G1:G$21))),),2),MID(INDEX(G$1:G$21,MIN(IF(G1:G$21<>"N/A",ROW(G1:G$21))),),4,2)))

And you must confirm with Ctrl+Shift+Enter before you copy down.
 

Attachments

  • Chandoo - jindon date question.xlsx
    11.8 KB · Views: 1
Something like below?
=IF(G2="N/A","N/A",IF(ISNUMBER(G2),G2,VALUE(RIGHT(G2,4)&"/"&LEFT(G2,2)&"/"&MID(G2,4,2))))

Since I'm using Japanese regional setting on the copy of Excel I'm working on, you may need to change below portion of the formula.

VALUE(RIGHT(G2,4)&"/"&LEFT(G2,2)&"/"&MID(G2,4,2))

To
VALUE(LEFT(G2,2)&"/"&MID(G2,4,2)&"/"&RIGHT(G2,4))

Edit: Unified cell reference.
 

Attachments

  • Chandoo-TextDate.xlsx
    11.9 KB · Views: 0
Last edited:
Back
Top