Excel formula to compare dates between three columns - excel-formula

I have ran into a roadblock with a spreadsheet that i am building. The section i need help with will be 3 columns containing dates. Below is what im trying to do. Condional Formatting will be applied to Column “C”
If “A1” or “B1” are blank then ignore it, but if “A1” or “B1” has a date, then compare the dates to the date in “C1” and if either “A1” or “B1” are Greater Than “C1” then “C1” should turn RED

Your conditional formatting rule will be MAX(A1:B1) > C1.
You don't need to check if they are blank using this route. These will be evaluated as 0 by the MAX function. When this is compared to an actual date, it will surely be less than your value in C1 assuming it is a valid date
[

Related

Excel Conditional formatting Dates older then 60 days

I'm trying to use one Conditional formatting rule that does the following:
Ignore Blank Cells
Ignore Cells that do not have a date value
Highlight Dates that are going to expire in 30 days
So i have a list of dates:
07/25/2021
06/25/2021
05/25/2021
etc...
i used the custom formula under conditional formatting and used the following codes:
=CountIF(A:Z,today()-30)
i also used
=CountIF(A:Z,"<="&today()-30)
both codes highlight blank cells, i tried using the IF statements or IsBlank statements but i don't think i fully understand how those work. because i made a mess.
regardless of what i do, cells that are non-dates and blank cells are highlighted.
i even tried using the the conditional formatting rule, "Format only cells that contain" and i added the following:
Format Only cells with:
Cell value - less than or equal to - Today()-30
what do you guys think im doing wrong?
Assuming that your dates are in column B:
Select entire column B.
From menu start Format / Conditional formatting...
Add a new rule with the plus sign.
At Style select Classic.
After select Use a formula to determine which cells to format
Enter this expression: =AND($B1<>"",$B1<=TODAY()-30)
Select a desired formatting.
You can easily adjust this to row or any other range, or +30 days etc.
If you need more columns, select all of them, and assuming that the first column is A, the formula should be: =AND(A1<>"",A1<=TODAY()-30). See the screenshot below with formula and some example data:

Conditional formatting is not working for less than TODAY(), only for greater than

Conditional formatting does not apply to dates less than TODAY(), only greater than TODAY().
I have an IF statement with two VLOOKUPS inside. One of them outputs "Not Registered" if the cell looked is empty. The other, just copy the data that is on the other spreadsheet.
=IF(VLOOKUP($A5,Table,#MATCH(D$3,Headings,0))=0,"Not
Registered",VLOOKUP($A5,Table,#MATCH(D$3,Headings,0)))
Conditional formatting is set to:
cell values >= TODAY() are green
cell values < TODAY() are red
cell values = "Not Registered" are yellow
I suspect the conditional formatting is not reading properly the date. Every date cell is formatted as long date.
The problem comes up because A3 is empty.
Change the rules to use =Today() or populate A3 with the desired date.
Edit 1: If this is not working for you, check the data type of cells that should be red. If these are not real dates (but text), then they will never meet the condition. Make sure that all cells that look like dates actually contain dates (and not text).
If the lookup table stores the dates as text, then you can make the changes there, because the Vlookup will return the same data type.
Edit 2: Selecting a cell and changing its format will NOT convert text to a date. You can test if a date is really a date by changing its format to General. If this results in the cell showing a number, then it's a real date. But if the cell appearance does not change, the value is text and you need a different approach.
One option would be to use a helper column with a formula like =DateValue(A1). Copy the helper cells and paste them as values over the original cells, then format as date.
Or, put a zero into any cell, copy the cell, then select all cells that may or may not be dates and use Paste Special > tick "Add" > OK. That will convert dates stored as text back to their internal storage number. Then format the cells as dates.
Or, do the conversion after the Vlookup by wrapping a DateValue around the VLookup formula.
=DATEVALUE(VLOOKUP("a",A1:B1,2,0))
The "date" in B1 is really text. The Vlookup returns it as text, but the DateValue() then converts it to a date. If this one throws an error, the date text does not agree with your regional settings of what a date is expected to look like.
Reason:
Whenever the cell go past by the Less than today rule, computer will read that as zero so it will return true because zero is less than today.
Solution:
On the Conditional Formatting Rules Manager,try to enable the Stop if true for the not registered rule.

How to count cells that have conditional formatting

So I have a spreadsheet that keeps track of projects that includes a target date column and an actual date column. The actual date columns have been conditionally formatted to turn red or green if they meet the target date or white if N/A has been entered. Green is <=Target Date and Red is >Target Date.
I am trying to create metrics for these dates to see on time delivery etc. So I have the COUNT(Target Date) function to count the dates that have been entered which omits empty cells and cells with N/A. But I'm stuck on how to count cells that have turned green for on time delivery. I have tried the COUNTIF function and using the same rules (<=) as the conditional formatting to count the cells, but it is just returning with 0.
Is there any way around this?
The Range object has an attribute FormatConditions, which keeps the conditional formatting definitions. You can check this, using VBA. I don't think it's possible reading this using a simple formula.

Excel: Count every date in a column and give back the sum of dates (preferably in *one* formula)

As you will see in my picture, I do have the following problem: I want to find out whether a value in a cell of column A contains a date or not. In order to do so, I have used the following formula in cells B1:B8:
German Excel formula: =WENN(ISTZAHL(TAG(A1));1;0)
English Excel formula: =IF(ISNUMBER(DAY(A1)),1,0)
As you will quickly notice, it works for B1:B6 but is faulty when it comes to B6:B7, etc.
So: What is wrong with that formula? Column A is formated as TT.MM.JJJJ (or DD.MM.YYYY) as a whole.
If that formula were to work properly, I could easily count the number of dates in column A using column B. But: Is there a way to do this without having to use column B, that is, checking whether a cell in A contains a date and adding it up in one cell with a respective formula?
You need to check if the cell is empty before checking if it's a date:
=IF(A1!='', IF(ISNUMBER(DAY(A1)),1,0), '')
If you want the sum, you can use
=COUNTIF(B16:B23,">32874")
32874 is the decimal representation of 1/1/1900, if you need to parse earlier dates, you can just use 1 too.

How to check date format in Excel

I have around 20,000 records in an Excel file and around four columns which have dates. I am trying to insert those into SQL. However date columns have dates in incorrect format eg; 02/092015 or 02/90/2015 or 2015. So checking 20,000 records one by one would be very lengthy.
I tried to count / but it didn't work. It changes the format of column to date.
I was looking for some formula which can check the format and maybe color the cell or something like it.
I was running across this issue today, and would like to add on to what nekomatic started.
Before we begin, the TEXT formula needs to follow the date format we are working with. If your dates are in month/day/year format, then your second argument for the TEXT formula would be "mm/dd/yyyy". If it is in the format day/month/year, then the formula would need to use "dd/mm/yyyy". For the purposes of my answer here, I am going to have my dates in month/day/year format.
Now, let's assume that cell A1 contains the value 12/1/2015, cell A2 contains the value monkey, and cell A3 contains the value 2015. Further, let's assume our minimum acceptable date is December 1st, 2000.
In column B, we will enter the formula
=IF(ISERROR(DATEVALUE(TEXT(A1,"mm/dd/yyyy"))),"not a date",IF(A1 >=DATEVALUE(TEXT("01/01/2000","mm/dd/yyyy")),A1,"not a valid date"))
The above formula will validate correct dates, test against non-date values, incomplete dates, and date values outside of an acceptable minimal value.
Our results in column B should then show 12/1/2015, not a date, and not a valid date.
Two of the examples you give are text which may be identified with Conditional Formatting by applying a formula rule such as:
=ISTEXT(A1)
and colouring the result as you wish. There would be an issue if all your dates (even those of valid format) are also text but I'm guessing that is not the case.
For the third example (ie 2015) a CF formula rule such as:
=AND(A1<2500,A1>0)
may help.
If your columns are a mixture of what should be dates and other entries that are properly text strings your approach may be better than the more general ISTEXT, for example a CF formula rule of:
=FIND("/",A1)>0
If you can add a column to the Excel sheet with the formula
=DATEVALUE(TEXT(A1,"dd/mm/yyyy"))
this should return #VALUE if the contents of A1 are not a valid date in dd/mm/yyyy format. You can filter on this value to identify the incorrect records.
Edit: If A1 contains only 2015 this formula returns 07/07/1905 (if the formula cell is formatted as date) so you can spot these by filtering for dates before the earliest correct date your file should contain.

Resources