Formatting change according to expiry date - excel

Is this even possible and if it is, what would be the best way to go about it?
What I'm trying to do?
I've been trying to setup a database of documents in Excel (name of document with a hyperlink to a folder structure where it is saved) along with their dates of issuing, time period for which they are valid and their expiry date - each in its own column.
For example, a date of issue for Document_001 is 21-02-2015, it is valid for one year, so its expiry date is 21-02-2016. That part is solved.
Now, these documents are certificates of a certain kind, and they are issued upon inspection completeness, which takes some time to organize and prepare. That's why in the fourth column I have a date which is 3 months before the date of expiry. So, for Document_001 that would be 21-11-2014.
Now the part which I cannot figure out; is there a way to make Excel compare the dates in this column with the current one (TODAY()) and change the colouring of the cells which are past it?

If you had the 'warning date' in cell D1 (for example), you can add the following formula in another column:
=today()-D1
If you format this cell as a number, this will give the number of days between today and the warning date. This number will be positive if today is before the warning date and negative if the warning date has passed (or zero if the warning date is today).
You can then use conditional excel formatting, and then format the cell, for example, in red if the cell value is negative. Conditional formatting is slightly different on older versions of Excel, but there is an overview here

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.

excel date format not working mm/dd/yyyy to yyyy-mm-dd

Have a column defined as Date yyyy-mm-dd:
Date format setting
The 2020-04-13 date is the existing data.
I pasted in new data 03/31/2020.
I tried doing format painter to apply the cell with 2020-04-13 to 03/13/2020, but the format would not change.
Also checked the Date format dialogue as show above, both cells show the same setting.
Why is the 03/31/2020 not changing to the desired yyyy-mm-dd format?
BTW, In my windows date format settings, I have:
Windows date format setting
#Scott Cramer answered your question but didn't provide a solution. That lies in how you enter the date[s] you want to format.
If you enter a date in a cell that is formatted as Date Excel will record a "True date" which is a number that is converted to look like a date by the cell format. If Excel doesn't recognize your entry as a date, even if you do, the entered value will be recorded as a text string, just what you entered, and I'll call it a "fake date". You can see that it doesn't really matter what you enter or what format you set, only what Excel understands.
Excel understands what you have set up in Windows settings. Now, you see that your settings are confusing. The long date is set up as Month, Day, Year whereas the Short date gas it Year, Month, Day. I haven't tried whether this will be an issue of significance because it's unlikely that you will enter a Long date in a cell and ask Excel to recognize it as a true date. Most of the time Short dates will be entered. Based on your settings you should enter "2020-3-13". If you want "31-3-2020" to be recognized as a date when you enter it in a cell you must change the setting to the Month, Day, Year sequence.
Two notes in this regard.
In most cases you don't need to enter all four digits of the year. Excel will interpret the last two correctly.
The date separators are important. If your set format has dashes Excel won't understand slashes and v.v.
And, finally, you can change the format of a cell containing a date to General or Number and see the number underlying a true date. You can also try a calculation. If A1 contains a true date then =A1+1 will return a date of the next day.

Converting month number from full date cell into text month in Excel

So I have a pretty long column with name dates and hours, like this:
14/01/2017 03:30
(They are DD/MM/YYYY HH:MM)
I need to get the month number and show it as text, like January, February, and so on.
If I format the destination cell as 'MMM' all the column cells show January even if the given month is 2, 3, or let's say 12. I also tried the formula =TEXT(L2,"mmmm") (since the given info come from column F.
Any ideas?
sounds like your date and time are stored as text and not in excels serial date format. You can test this by changing the format of the cell to general and seeing if anything happens if nothing changes then its text. another way would be to use the formula =istext(A1) where A1 is a cell with a date in it.
Now ASSUMING you do have dates in text format, I would suggest converting them to excels date serial. There are numerous ways of doing this. I will show you one way.
This will strip each component of the text out and then recombine it. We will assume your date in is A1
Strip out the year
=MID(A1,7,4)
Strip out the month
=MID(A1,4,2)
Strip out the day
=LEFT(A1,2)
Now to recombine it:
=DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2))
That will give you the date in an integer format that excel can then turn around and display as needed.
In order not to lose the time component you should strip that part off as well and combine it with the date. Remember the date is an integer, and the time is everything after the decimal. Think of time as a fraction of a day.
To get time out use:
=RIGHT(A1,5)
and to convert it to excel time:
=TIMEVALUE(RIGHT(A1,5))
and to get the two together, simply add:
=DATE(MID(A1,7,4),MID(A1,4,2),LEFT(A1,2)+TIMEVALUE(RIGHT(A1,5))
The key part to this whole thing is you will need to format that cell to display what you want. you can either choose a preformatted style from the drop down menu, or you can apply custom formatting. Setting the custom format to MMMM should display just the full name of the month.
IF you actually need the text of the month and not just the format, then you could use the formula from your question:
=TEXT(<insert appropriate formula from above>,"mmmm")
Try using MID to get the month only, then TEXT():
=TEXT(MID(A1,SEARCH("/",A1)+1,2),"MMMM")

Inserting a fixed date within a condition in Excel

I want to create a condition that, if it exists, its execution date will be preserved
For example, if the number 10 appears in a cell today, I want the today's date (17/5/17) to be stored in the cell next to it, and tomorrow the today's date (17/5/17) will appear in the cell.
So I tried to use functions like TODAY or DATE, but if i use them - then tomorrow the date in the cell will change to tomorrow's date.
How can I keep the first date of the condition?
You can't. At least not with formulas. A formula using Today() will always recalculate to deliver today's date. That's the purpose of the Today() function.
For a static time stamp, you will need to engage VBA to capture today's date and write it as a hard coded (or constant) value, so that it will not be updated when the sheet is recalculated.
You may want to research topics like "Excel date stamp" or "Excel time stamp" for VBA code examples that use that approach.
You still use the function TODAY... but you will need to write a Workbook_Open subroutine (which will automatically run once every time the workbook is open) to change the formula to actual date value...
You can switch off the automatic update in the calculation options of formula so that it only updates when you press F9. But this means that if the value of your reference cell changes then today's date will not be modified, even if you want it to.

Resources