Keeping date style while column is formatted to text - excel

I hope you can help. I am having an issue with formatting.
The issue is this.
In Pic 1 below you can see Column H. Column H needs to stay formatted as Text. The date 03/14/2017 as text is 42808. What I need is the date to be text but remain in this style MM/DD/YYYY. Is there a formatting option that will allow 03/14/2017 to appear in this way and the cell to be text.
I have tried custom MM/DD/YYYY;# but this formats the cell as date again not what i want. I know I could manually type in 03/14/2017 but I want to avoid manual work.
As always any and all help is greatly appreciated.
PIC. 1

Formula:
=TEXT(H2,"MM/DD/YYY")
VBA
ActiveSheet.Range("H2").Value = Format(ActiveSheet.Range("H2").Value2,"MM/DD/YYYY")

Related

Change dot formatted date to Slash format

Hi all I want to change the date format from dot to slash and I have tried all ways of changing the date from control panel and also from the "Format option" in excel but nothing works.
Please would anyone can recommend how can I do this bulk change of format of date except doing it manually.
Any advices would be much appreciated.
First of all, make sure the value you have in the spreadsheet is a valid date.
Excel might interpret the value as plain text.
After you make sure it is a date, then you can change the date format using the cell attribute editor
You can use formatting like dd/mm/yyyy or mm/dd/yyyy
You can use substitute to replace the dot with a slash, then wrap that with datevalue to convert to a date. Lastly, format the cell as your desired Date format (such as Short Date or Custom).
Below, column A is your original data.
Column B contains the following formula:
=DATEVALUE(SUBSTITUTE(A2,".","/"))
Output:

Extracting Date From Cells using excel formulas

Im exploring how feasible it is to extract data from cells that consist of text. ultimately. I will apply conditional formatting rules based on the date relative to today, but right now I just need to be able to extract them.
So far I have achieved the following:
To achieve this I've used the formula found online =IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),""). The issue is that if a cell contains only a date, the Length is subtracted from itself and nothing is returned. I have tried modifying the above equation but keep running into errors.
Hoping someone may be able to help me out modify this formula. Alternatively, if anyone knows how dates can be extracted used just excel formulas that would be great.
The issue is that without the other text it is a true date and a true date is a double and has no - in it.
The simple fix is to wrap change the"" return from the IFERROR to B2:
=IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),B2)
If that is not sufficient you can do an IF to test if date:
=IF(ISNUMBER(B2),B2,IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),""))
This is a solution I came up with with appears to work for almost Any Date format provided the date is at the top of the cell. Note this was done for dates in cell H6 of my workbook.
The formula below can be entered below to extract the date from this cell amongst text.
=TEXT(IFERROR(LEFT(H6,SEARCH(CHAR(10),H6,1)-1),H6),"dd-mmm-yyyy")
This formula checks if the date is within 3 years and returns a true of false value. This can be used to conditionally Format Cells if the date once extracted is out of date.
=IF(ISBLANK(H6),FALSE,IFERROR(IF(DATEVALUE(TEXT(IFERROR(LEFT(H6,SEARCH(CHAR(10), H6, 1)-1),H6),"dd-mmm-yyyy"))<=TODAY()-(365*3),TRUE,FALSE),TRUE))
Works really well for me!

How to get what excel cell is showing?

I have a strange question.
Screenshot:
From the screenshot you can see that the formula bar is showing just a single apostrophe. This is on all of the blue cells. These should be dates but all this data is coming from a excel plugin (Board)
From what I know Excel treats this cells differently i.e. everything after the apostrophe should be shown as text but here there is nothing after the apostrophe and the cells are still showing a values.
Is there a way with formula that I can get and compare this value with another cell in different worksheet?
EDIT:
If there is a way to get it as a text, could it be than converted into date format number?
EDIT 2 - SOLUTION
As per Mahesh and Jeeped comments - there was a newline character in the formula bar
If the date is preceded only by a new line and there are no other characters after the date, this will be much simpler:
=VALUE(REPLACE(A1,1,1,""))
This will give you the date value in general format (i.e., 43033), so you'll have to format it as a date.
Note: Using DATEVALUE instead of VALUE will give you the same result.
You have not confirmed the vbLF characters in the cells but try this in an unused cell to retrieve a true date.
=datevalue(trim(mid(substitute(kn1, char(10), rept(char(32), len(kn1))), len(kn1), len(kn1))))
Assuming that you are on a DMY regional format that should get you a number like 43028. Format it as a date.

what's wrong with my excel value?

i got error formatting in excel. in the row "in CCC" value formatting got some error , it
here some screenshot:
Two ways, highlight the whole column that you want to change the format.
Right click > Format cells, and pick the format that you think is applicable under `Number tab.
Over the Ribbon, you should see a drop down under Home > Number and you can pick the format you want there too. Here is a screenshot for your reference.
Good luck.
Select the whole of the CCC column.
Go to Number format and make sure the same format is entered for the whole column.

Changing date excel cells

I have a date cells which contain the date format with the general. I want to change its cell with the same format like other cells but the problem is if I change it then it will change the entirely format of its cell.
What I've tried so far is within this formula inside of its formatting cells
(mm/dd/yy hh:mm:ss)
But I all I want to is just using the same format like the others. Thanks
Check on the file please try to change the value and any helps will be so much helpful
https://hotfile.com/dl/157148115/5ee7808/datesample.xlsx.html
The dates are stored as text
You can use datevalue and timevalue to convert the data to a real date format
in A2, enter =DATEVALUE(A1)+TIMEVALUE(A1) to get a value you can format as you wish
"05/02/2012 16:23:53" 41031.68325
"05/02/2012 16:23:53" 41031.68325
"05/04/2012 08:17:52" 41033.34574
the value displayed in the 2nd column is the excel representation of a date/time - you can then format these how you want, or do calculations to get durations.

Resources