How to count cells that have conditional formatting - excel

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.

Related

Excel conditional formatting to identify values that are time values not numeric values

I need to use conditional formatting to either: -
Identify time values in a sheet which should only contain numeric values or
Identify any cells that aren't numeric values (not 100% on this as time values possibly stored in similar to numeric values).
I'm looking around and experimenting all morning but I can't nail it down.
Any help much appreciated, thanks.
Edit: For reference, this answer does not answer my question, as I'm trying to identify cells that contain time values, rather than simple numeric values.
If you use the following formula as a conditional formatting rule it will then highlight the cells that are time values.
=TIMEVALUE(TEXT(C3,"hh:mm:ss"))
In testing I have had to create the rule on a cell that is already a number value and then apply it to every other cell as it was changing the format of time cells to their underlying number if done otherwise.
Create a new conditional formatting rule for cell C3 with the above formula as the rule.
Then when applied, right click the cell and copy, then select the range of cells you want to apply the format to and select Paste Special - formats.
This should then hightlight any value that has a time format

How do I apply conditional formatting to an entire column based on the previous rows value?

I am trying to create a worksheet which colour codes the cells according to the next date. If the value of 1 July is higher than the value of 30 June then the cell of 1 July needs to be green but if its lower then it needs to be red. This would then apply to all dates in my worksheet according to the previous days value.
I am unsure how to apply conditional formatting to an entire column based on the previous rows cell value and not one single cell value
The conditional formatting will be applied when the criteria result = TRUE.
Here is the formula to enter into the conditional format window to result in a RED cell. Green would be the same, but with a greater than symbol. Click on the first cell that should be conditionally formatted, then create the conditional format rule and check it. Then copy the cell, highlight the range of cells to be formatted and paste-formatting only.
Note, in your explanation you mention that a lower value than the prior day should be RED, but the image shows GREEN. You can reverse the formula below based on the output that you need.
=AND(ISNUMBER(B2),ISNUMBER(B3),B3<B2)

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.

Excel formula to compare dates between three columns

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
[

Conditional format based on a cell's color

I have a column with conditional formatting rules set to make the background one of three colors based on how close the date is in comparison to the current date (Today's date + 7, + 15, +30 days).
I want to extended the conditional format across to effect the entire row, rather than just the individual cell for the user more easily to see which item's date is approaching.
Is it possible to do a conditional format using a cell's format?
Update: To explain it further. Conditional format is set to a column: if a cell value is in between today's date and 7 days from today's date, it is formatted to have a green background. I want this format to extend across the ROW in which the value turns green.
Please try:
where the three formulae are:
Green =$A1<TODAY()+7
Orange =$A1<TODAY()+15
Yellow =$A1<TODAY()+30
and I have assumed each 'row' spans A:Z and your dates are in ColumnA.
This will highlight dates earlier than today also (though could easily be adjusted).
Just change the Applies to range to all the columns you want to be colored. You'll need to make sure you lock down the reference of the date column in the Conditional Formatting rule.
For example:
If your data is in columns A:H, then your Applies to range will be =$A:$H
If your date column is column C, then your conditional formatting rule (for C1) would be something like:
=AND($C1>=TODAY(),$C1<=TODAY()+7)

Resources