How to change general date format in excel? - excel

Quick but not a simple question for me: How to change the date format in excel so it not only affects how I see the date but also how Excel understands this format?
I mean, I want to have date like 04/13/2018 in cells and I changed to this format (it works fine) but excel still converts it to "13.04.2018" in the text field above the sheet. And It cannot be like that because I have macros built in those cells that keeps throwing errors that date format is still wrong and it needs "MM/DD/YYYY"...
Maybe I can somewhat change my region/locale formats in excel?
Alex

The result that came out shows that Excel understands that format. If you want to make sure that Excel understands your style of format, then you probably would want to change the DATE and DATE_TEXT function.

Related

How do I make Excel read my not completely filled in dates correctly in my regional format? (dd.mm)

I have used a previous version of Excel and OpenOffice Calc, and I was able to format dates to the Ukrainian format "dd.mm.yy" so that when I typed for example "1.8" in the cell marked with this format, it correctly read it as "01.08.22" (the first of August of the current year). Now I'm using the newest Excel and for some reason when I type in "26.08", it autocompletes as "26.01.00" with the following in the formula section: "1/26/1900 12:14:24 AM". Now I could understand not filling in the year I want it to, but not even the month?
And when I do fill it in fully, I don't think it recognizes the text as a date at all! The dates filled in previously in the same document are interpreted and formatted correctly, but not the new ones. The format is identical, I formatted the whole range of cells together.
Typing "8/26" gives me the desired date, but it's not my regional format and it's inconvenient to use.
Is there a way to make Excel do what I want, here?

Excel EOMONTH date function

I am trying to use EOMONTH in excel, but I cannot make it work... It i not recognising my date as a date.
I am using excel for mac (ver16.45), in column I type for example 01.01.2020, or 01/01/2020 it always formats as 1.1.20. When I try to change formatting I have asterisk for default date as in my system as *14.3.12 and I leave it like that... than when I use =EOMONTH(C1,0)...
I am getting error ("Not trying to type a formula?
When the first character is an equal ("=") or minus ("-") sign, Excel thinks it's a formula")
I know that for EOMONTH excel need to recognise data as a date, and that it needs to be in format of the system... but for me is simply not working...
I don't know is it mac maybe, or what can be...
Thanks!
It would be helpful if you could upload a copy of your workbook, or at least a screenshot of your scenario, so I can get a full understanding of your request. Based on your initial comment, can you replicate my screenshot and let me know if it works?

Using EPPlus, how do I return a cell value as it has been formatted by Excel?

I use EPPlus to load an Excel file that has numeric cells having this special format:
00"."00"."00"."000"."0
Hence, a cell value of 123456789 is displayed on Excel as 01.23.45.678.9
It's a sort of a material coding standard. Now, I would like to use EPPlus to return the formatted value in a string. I am not really interested in the numeric value. Also, I don't want to do the formatting manually in my code because the number format may sometimes vary. How would I do this?
Thank you :)
This looks like an issue in EPPlus. (update: I filed an issue.)
If you run your example with EPPlus under a debugger, you'll see that EPPlus is producing the string value from ExcelRangeBase.cs:965 using the expression d.ToString(format, nf.Culture) where d is the converted double value of your cell's text, format is "00.00.00.000.0", and nf is an EPPlus ExcelFormatTranslator (but the latter is not important to this particular issue).
The issue is that an un-literalized . in a custom numeric format string is taken to be a decimal point. So the value of format at this point in the EPPlus code should be "00'.'00'.'00'.'000'.'0".
I'm not yet sure what would be the best fix for this, but it looks to require a change somewhere in ExcelNumberFormatXml.ExcelFormatTranslator.ToNetFormat.
In the meantime, you don't have to do the formatting manually in your own code. Before calling the Text property, you can set the number format to what it should be, e.g.:
range.Style.Numberformat.Format = "00'.'00'.'00'.'000'.'0";
Now range.Text should give you the string you were expecting.

How to change a column with date and time as string format in Excel into a column with the same date and time in date/time format?

I have a column in string format in Excel (2010) which shows "yyyy-mm-dd hh:mm:ss" and for an analysis I need it to be exactly the same, except that it is in date+time format instead of string format.
After some googling I got that macros will probably help me, but I never worked with visual basics in Excel before. On top of that, the questions I found which come close to this every time seem to have a very different solution.
I got so far that I have visual basics up to enter some code (yes yes, you may laugh at my poor skills), but I have no clue what code to enter there.
Thanks.
To get both the date and the time, use =DATEVALUE(A1)+TIMEVALUE(A1).
You don't need VBA. Use DATAVALUE function.
First try formatting the column as dates, you can use your format "yyyy-mm-dd hh:mm:ss" in the Custom Format, Type box.
If this doesn't work then create an extra column using =DATEVALUE(A1) and copy this down the column. Format it as required. You can Copy/Paste Values so that you could then replace the original column.
You can just use
=VALUE(A1)
and if Excel can interpret the string as a date, it will.

Change contents of cell where formatting cells doesn't assist

I have a cell with the data in it in the format of 01/07/2012 6:58:13 AM
However I would like the date only, I have tried to Format Cells and select the format I want 01/07/2012 but the time still remains.
How can i get rid of it?
Assuming that the date for some reasons is stored as text (e.g. you're using a non-English system), you can parse the text and convert it to a proper date with the following function: =DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2))
If you have an English system (it might also work on other locales, just give it a try), you don't have to parse the text, but simply convert it with this formula: =--A1 (and format the cell as Date).

Resources