How to show dates in a chart in Excel? - excel

My date data in x axis is in this format: 11/15 (without year).
How to show dates in a chart from 15Nov to 29Apr in Excel?
Below chart is not correct. The first dates have moved to end.

I converted dates to text using: =TEXT(B2,"mm/dd") for all of rows.

Excel will add a default year (current year) for you when you enter just the month and day. so 15-Nov is actually 15-Nov-2017, and 29-Apr will also be 29-Apr-2017. So the 29-Apr will be assumed sooner than 15-Nov. I know you want 15-Nov for previous year and 29-Apr for next year but excel does no know your meaning..
So, you have to add the year part to your dates (even manually or using an formula) to specify exact order of dates and then use a format string to hide year in your cells like as mmm/dd.

Related

Conditions in Excel: skip cells with dates without a year

I have the results of a survey with birthdays in various date formattings.
01.01.1990
02/03
04.05 etc.
Every time Excel sees a day and a month without a year it implies the current year and puts it in the cell without any hesitation. So, when we try to extract a year, we get not the error we expected but the current year, which is nonsense.
How can we avoid this behaviour?
The desireable result is:
One column with one formula
If the year is written, we extract it using =YEAR()
If it is absent, we just do anything else, for instanse put "".
Basic change of formatting doesn't change the implication of the current year. And if we change the format of the whole column from date to text, we cannot use the formula "YEAR" anymore to any of the cells.
This is a task for students who can deal with Excel and Google Sheets only, Python is not an option.
I would be very grateful for any help!
Both Excel and Google Sheets stores date as a number (day count) starting from 1900/01/01 so it either assumes year for you or doesn't recognize it as date at all.
If you convert date to number, 1900/01/01 will be 1, 2023/01/16 will be 44942 (as it is 44942 day counting from 1900/01/01).
I assume that survey can't be filled by people born this year so just "filter" them out:
If date is in A1 use formula:
=IF(OR(YEAR(A1)=2023,YEAR(A1)=1900),"",YEAR(A1))
This will print nothing if captured year is 2023 or 1900 (this behavior also possible when dealing with dates without years).

Excel - count days between two dates per year

I am trying to get the number of days per year between two dates.
The results should look somehow like the following picture
The range between the 2 dates in the 2021 year has 301 days and in the 2022 year has 94 days.
Put this in C2 and copy over:
=MIN(DATE(C1,12,31),$B$2)-MAX(DATE(C1,1,1),$A$2)
Your question isn't entirely easy to understand but what you don't know is in plain sight: Excel represents dates as integer numbers where Jan 1, 1900 is the first day (= 1) and all days from then till now have a unique number. Today is 44261. Tomorrow will be 44262.
Therefore the difference between dates equals [End date] - [Start date], where only one of these two dates is included in the count. [Tomorrow]-[Today] = 1, not 2.
When a worksheet cell is formatted as General Excel will automatically change that format to whatever Excel thinks you have probably entered. If you enter what Excel recognizes as a date the cell format will be changed to Date and if the way you entered the date was by function, such as =TODAY() the cell will display "6/3/2021" using the date format specified in your Windows International settings.
But if you manually change the cell format back to General or Number the display will change to 44262. That's the way you can test if your cell contains a "true" date, with which you can do calculations, or a "fake" date, which is just a text string which is nice to look at but otherwise useless.

MS Excel Scatterplot converts Months to Numbers

Software: MS Excel 2016
Link to files: GitHub Repository
Sheet2 of month.xlsx has table
When I select it and Insert Scatterplot, Chart1 of month.xlsx is the result. No matter what I try, I cannot get the X-Axis to display in Months (right now it displays Month's number).
Help!
You can not make scatterplots using a category. Scatterplots assume both axes are numerical to enable you to have fractional values on x and y axis. You will have to change month onto numbers such that they scale correctly. I'd suggest the day of the year. February 5 would be day 36, for example. Or use the month number but beware of the differences in the number of days in a month.
The problem is most likely the way you have your months stored. By the looks of things I would hazard to guess they are actually text and not numbers formatted to display the name of the month in full. In order to get the months to display in your graph, you will either need to enter the months as a serial date which Excel can understand as a number, or create a dummy column to hold this same information which you can latter hide.
once you have your months in a serial date that excel can handle, you can then select the X-axis and set the format style. Select custom as the category, and then use mmm or mmmm as you custom format to display just the name of the month. Alternatively you could show the whole date using date formats.
Two ways to enter a date serial are to simply enter the numeric date format that matches your regional settings or use the following formula:
=DATE(year,month,day)
Where year, month and day are all integer, or formulas that evaluate to acceptable integers

Excel Gantt chart format date after week number on axis

I have a sheet of processes all mapped to starting dates and ending dates, that are used to generate a Gantt chart. However, instead of dates formatted as "MM/DD/YYYY" on the X-axis, I want the year and week number ("YY/WW"). I haven't been able to find anything on this. Could it be done in the excel interface, or at the very least programmatically in VBA (Which I have very little experience in)?
Assuming your data is in Cell A1 this will build a week number and year number as you have described. The left side simply grabs the year with a function and only takes the last 2 digits. The right side returns the day of the year out of 365 then divides to get a week number, then formats the text to include insignificant zeros to preserve the WW format.
=CONCATENATE(RIGHT(YEAR(A1),2),"/",TEXT(CEILING((A1-DATE(YEAR(A1),1,0))/7,1),"00"))

How to subtract dates in Excel with different date formats?

I want to subtract 2 dates in Excel but the problem is they have different date formats.
So... my first date is something like this 18.09.2011 (DD.MM.YYYY) and the second one is something like 9/15/2011 (MM/DD/YYYY). So how can I subtract these two dates? Because DAY(cell of date one) - DAY (cell of date 2) won't work.
Thanks!
If your dates are really entered as dates you can use them in any kind of calculation, as a date really is stored as a numeric value. Displaying one date in "MM/DD/YY" and the other one in "DD.MM.YYYY" doesn't make a difference. Try to format the cells as "General". Does the display change to a number (e.g. 40801 for today) you're fine. If your dates are entered as strings you may want to convert them into dates first - see this post

Resources