I have a spreadsheet where I calculate data by day for 3 week periods. Each day is compared to the previous day so I can see fluctuations in each row from day to day. I use conditional formatting to highlight positive or negative fluctuations assigning any negative values that appear as red text and any positive values as green. I only ever manually enter data into the columns for the specific days and allow excel to do the "heavy lifting" of subtracting one cell from another and then conditionally formatting based on the result. I've run this spreadsheet for over a year now, again working in 3 week increments, and in each of those 3 week sections the same column that represents day 4 (Column G in the screen shots) has the same problem. I've ignored it for over a year and now I can't take it anymore.
Here's the issue. I have no conditional formatting assigned to any of the columns that I type into, the columns represented with "Day #" in the screenshot of my spreadsheet. But yet when I get to Day 4 and type any value into that column it gets the conditional formatting applied to it that only the columns that display my differences should have.
NOTE: These screenshots are of a test instance of this problem that I created thinking the issue might be with my original file, but I was able to recreate the problem with a completely new spreadsheet.
I've had times where I've checked my conditional formatting 'Applies To' field prior to making any change to column G just to ensure that column, or any of its cells, aren't listed. Then the moment I put a value into that column the cell I typed in gets added to the 'Applies To' field. This only happens to this column, no other column on the spreadsheet.
Here's what I think I've found and I can't see a way around it, and unfortunately I think I need to get pretty detailed with what the spreadsheet does to really explain what I think is happening.
Column A - Row title - no formulas
Column B - Represents Day 1 values - no formulas
Column C - Represents Day 2 values - no formulas
Column D - Represents the difference between day 1 and 2 - =C2-B2
Column E - Day 3 values - no formulas
Column F - Difference between day 2 and 3 - =E2-C2
Column G - Day 4 values - no formulas
Column H - Difference between day 3 and 4 - =G2-E2
Column I - Day 5 values - no formulas
Column J - Difference between day 4 and 5 - =I2-G2
Columns K through AD - remaining days and differences columns to represent the remaining days to get through 15 days worth of values and differences
What I think is happening, and what I can recreate, is that Excel is getting confused at the fact that I have a pattern of conditional formatting for every other column, but that the first two columns where there's no "Difference" column between them (columns B and C) I have no conditional formatting and it tries to recreate that pattern in column G the moment I start typing values into that column. I can recreate this exact same issue no matter what the columns are, once I reach the 6th column in my pattern excel adds cells that I type values into to the conditional formatting rules.
Has anyone else ever seen this? Any ideas on how to avoid it? I thought it was related to copying and pasting my sections as we start a new 3 week period but the fact that I can recreate the issue from scratch consistently removes that theory. Any help or ideas would be appreciated. The work around is of course simple enough but now I'm just curious as to what is causing this.
Blank spreadsheet prior to applying any values to any days. All of the formulas and conditional formatting is already applied to the Differences columns.
At this point I've entered values into the columns for Days 1, 2 and 3. Note how the conditional formatting dashed lines don't include anything for Column G cells.
After entering 2 values into cells in Column G those cells now appear in the Applies To fields for both of my conditional formatting rules.
If someone can explain this I will send them all of the high fives I have.
For a proper explanation could mean asking Microsoft because you may have analysed the behaviour to about the extent possible without inside knowledge.
However there are two simple workarounds. One is to apply a pair of rules for ColumnD that differ from the rules for the other columns. The other, my recommendation, is to rearrange the difference columns so that each falls between its start/end points. So the first would be in ColumnC with formula:
=D2-B2
copied down to suit.
Then for conditional formatting select ColumnsC:AD, clear existing formatting and and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(ISODD(COLUMN()),C1>0)
Format..., select green font, OK, OK.
Then for red font apply:
=AND(ISODD(COLUMN()),C1<0)
Since this way the Applies to range is unbroken (=$C:$AD) Excel will not be tempted to 'interpolate' for you.
Related
Edited for more info
I run a report which can start and finish from any dates (e.g. 1 May to 31 May). It plots the dates across the top row, breaking up weeks with two rows of calculations. So if I ran the report from 1 May (a Friday), across the top row it would have 3 dates (Fri-Sun), then two rows of information, then 7 dates, two rows of information etc.
I want to insert a macro that will insert a formula above any cell in this row which contains a date. I don't know how to insert something based on the formatting of another cell.
This is the top row of the sheet:
I could insert a formula (e.g. =IF(Q2=0,"",FORMULA)) and then convert to text. I've tried various combinations of the "IF" thing to see if I can get it to only action the formula if the cell contains a number, but I can't make that work either.
I could change the formatting of the dates as follows:
Range("Z1:AF1").NumberFormat = "dd-mmm (ddd)"
Range("AI1:AO1").NumberFormat = "dd-mmm (ddd)"
Range("AR1:AX1").NumberFormat = "dd-mmm (ddd)"
Range("BA1:BF1").NumberFormat = "dd-mmm (ddd)"
etc.
And run the formula if it contains "(Mon)" or "(Tue)" etc. But this only works if I've hard-coded the specific cells I want it to use, which means I can't run the report for any range of dates.
None of these are particularly agile, and seem to be working around an issue which seems that it would be quite simple (inserting the formula based on the formatting of the cell below it). But none of my Googling has brought up anything that suggests this is possible.
Thoughts?
I have a large client list with multiple columns. Columns of interest:
column E - file status/needs,
column H - next appointment date.
I need a formula to change the formatting of the row if column E reads "executed" or "signed" only if column H also reads a date prior to today's date.
For example today is aug 11, 2016, joe schmoes file is "signed" (column E) and the next appointment date is "aug 9, 2016" (a past date in column H).
I need the row to be highlighted so we can see that this file needs attention.
I have tried many different formulas and I am not getting anything to work exactly correct. The closest formulas I have are below:
=IF(AND(TODAY()-$H1>=0,TODAY()-$H1<=15),SEARCH($E1="signed",$E1="executed"))
The problem is if the cell in column E reads" signed" like I need it to the formatting doesn't apply - formatting only applies when column E returns a false value and the words signed or executed are not in that row's E cell.
I know the first part is also not absolutely correct as it is only searching for a value in column H between today and 15 days past. (I couldn't figure out how to write the formula to be ANY past date).
Another one I've tried that has worked is:
=IF(AND(TODAY()-$H1>=90,TODAY()-$H1<=365),SEARCH($E1="signed",$E1="executed"))
Obviously this is only for values in column H between 90 and 365 days past today but I'm having the same thing where the formatting doesn't apply if column E reads either of the two searches entered.
I have also thought of doing negative rules, basically write a rule that any past date in column H that has a word other than "signed" or "Executed" in column E will return a certain format but haven't tried any formulas for this yet.
If the formula you have is totally different than what I have but accomplishes the goal that is fine I just need this to work and I'm spending a ton of time using the research, trial and error method.
Select your entire sheet and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(IFERROR(SEARCH("executed",$E1)>0,SEARCH("signed",$E1)>0),$H1<TODAY())
Format..., select colour Fill (highlight) of your choice, OK, OK.
This assumes (amongst other things!):
executed and signed may be only part of a cell's content, might
occur together and should trigger CF regardless of case.
if the next appointment date is actually today, no fill.
the dates are not text format.
your version of Excel has IFERROR.
=AND handles the requirement that different columns are involved in the trigger.
Individually these are covered by a long element and, for the short element, the =TODAY function where the less than (<) operator if for where the date value in Column H is any date less than the current date, or no date value at all.
The longer element is a pair of =SEARCH functions, one each for executed and signed so that either (or both) will contribute to the CF trigger. Since the data may not be required to be case sensitive SEARCH was preferred to =FIND.
SEARCH returns the index of the position at which the search term is found and an error if not found. Since for these purposes where in the cell does not matter, any numeric result would serve and >0 covers all those possibilities. =IFERROR was used to trap an error arising from the absence of executed to allow searching to proceed for signed in that situation (otherwise the overall result of the formula would be an error and the CF not be triggered).
I'm looking to create a conditional formatting field which will compare the values of two cells on sheet 2, to then format the correct cell on sheet 1.
To give some background, I have a spreadsheet (sheet1) which gets information from (sheet2). (sheet1) concatenates the Assessment period (B4) with the Subject code (AA12) and the Pupil ID (A15) which in turn is used to look up the corresponding field in sheet 2 to get the information.
=VLOOKUP(CONCATENATE($B$4,AA$12,$A15),sheet2!$F:$M,7,FALSE)
Here, Column F in (sheet2) holds the concatenated field names and column L holds the Grade, I.e A,B,C etc.
Column M in (sheet2) holds the numeric equivalent of that grade, i.e A = 1, B = 2 etc.
The rows in (sheet2) hold information on the target grade and the current performed grade, as picked up from the concat where the assessment period is either 'Target Grades' OR 'Autumn End of Term'.
What I am looking to do is to have the grade in my original cell in (sheet1) to have conditional formatting applied based on if the numeric equivalent of the end of term grades in (sheet2) is <, = or > the target grades.
Im not sure if this is possible and have found some other helpful posts such as this one;
Multi-column vlookup conditional formatting
But my issue is that I have 000's of records so would be very time consuming and data heavy to have a conditional format for each and every record such as proposed;
=IF(sheet2!M12<ODBC!M4,"RED",IF(sheet2!M12=ODBC!M4,"YELLOW",IF(sheet2!M12>ODBC!M4,"GREEN")))
What is needed is to incorporate the VLookup so that this can be calculated all at once and basically smash these two functions together;
=AA15 < vlookup(CONCATENATE($B$4,AA$12,$A15)ODBC!$F:$M,8,FALSE)
=(ODBC!$F:M,8,FALSE)<(ODBC!$F:M,8,FALSE)
Please see the below images FYR
Sheet1;
Sheet2;
I'm not even sure if this is possible and is well beyond the scope of my Excel experience so any help would be very appreciated!
EDIT
I have tried this Formulae for the Green colour;
=VLOOKUP(CONCATENATE($A$2,E$5,$A8),Sheet2!$F:M,8,FALSE)<VLOOKUP(CONCATENATE($B$4,G$5,$A8),Sheet2!$F:M,8,FALSE)
This works but for some reason, when applied to other sections with the same added but with a '>' or '=' for red or orange it seems to break and not format properly.
Any Ideas?
I Have fixed this!
After much looking around it seems as though I was on the right track with the EDITs formulae;
=VLOOKUP(CONCATENATE($A$2,E$12,$A1),ODBC!$F:$M,8,FALSE)>VLOOKUP(CONCATENATE($A$4,E$12,$A1),ODBC!$F:$M,8,FALSE)
After coming back to this after a few days, the formulae seemed to work and I was able to successfully spread across the whole sheet, saving me countless hours of individual formatting! Not sure why this was not working originally, it may have had something to do with my cell selection within the "Use a formula to decide which cells to format"!
Here is a little backstory on what I am trying to do. First, I am NO Excel expert by an means, but I am a rather quick study and have been able to figure out things as I go.
I created a daily tracking spreadsheet (that I should probably use Access for...) that tracks how many employees worked, type of work they did that day, who didn't work, etc. Most of the cells are color coded, contain specific text or numbers (a LOT of Conditional Formatting is also applied).
The code that I need help with is currently hard coded to look at a specific column and a specific range of cells. I need the code to be able to select the range of cells based on the current date, which is listed along the 3rd row from the top.
So instead of this: =IF(COUNTIF(Y4:Y61.... I need Y4:Y61 to be a formula that determines what cell the current date is in and calculate in that specific column's range of cells.
thanks in advance
Patrick
For COUNTIF() you could simply add the date column being for today as a criterion.
Assuming you want a more general approach you can use the OFFSET() formula as you can specify the position and size of the range.
Consider a sheet like this
A B
1 2015-10-27 1
2 2015-10-27 1
3 2015-10-28 1
4 2015-10-28 2
5 2015-10-28 1
6 2015-10-29 1
and today is the 28th of October
You can sum column B by using
=SUM(OFFSET(A1,
MATCH(TODAY(), A1:A6, 0),
1,
COUNTIF(A1:A6,TODAY())))
What this does is:
move the reference of A1 to the row where your entries from today start.
It then takes one column of width.
We then give it a row height being the number of entries for today making the formula return 4 today and 1 tomorrow.
I have a worksheet containing dates when people have attended training courses. Each column relates to a different course and may need to be redone at different intervals. The interval (number of years) is shown at the top of each column.
I want a rule so that each cell's formatting is based on the value at the top of its column, so I can have one rule for the the whole worksheet, rather than needing a new rule for each column. If the value in the interval cell is 'N' it means that course doesn't have to be resat, so no formatting required. Otherwise, if the date in the cell is older than the interval (in number of years), apply some formatting.
I've come close. I've got the rule =IF($C$5="N", ,TODAY()-($C$5*365)) and this works (where C5 contains the retraining interval). However I need the last step of being able to reference row 5 of the column the cell belongs to so I don't have to make a new rule for each column.
Course A Course B Course C
How often? N 2 5
fred 1/01/2010 1/01/2010 1/01/2010
John 1/01/2011 1/01/2011 1/01/2011
Mary 1/01/2012 1/01/2012 1/01/2012
You need to remove the absolute column reference by deleting the "$" in front of the "C"s:
=IF(C$5="N", ,TODAY()-(C$5*365))
Now the formatting will refer to whichever column it's called from. Just make sure that when you enter it the active cell is in column C.