Conditional formatting rule based on multiple criteria and today's date - excel-formula

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).

Related

Excel Conditional Formatting Applies To Field Changing Unexpectedly

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.

Excel: Return Multiple Items with One Lookup Value but on a different sheet

My formula works, but only if its in the same page, and along the same rows
Formula:
=(INDEX($C$1:$D$4,SMALL(IF($C$1:$C$4=$F$2,ROW($C$1:$C$4)),COLUMNS(D1:D4)),2))
Note: Column G has the formula, what it does it look for value in F2 (which is 1.2) within the columns of C & D, and extracts the respective data in column D. So in this case, it would extract the data in column G.
Question: Now what do I do if I want this to occur from different sheets, or even different workbooks? I need to do this exact same thing, extract the data that is in column c and d (which is on a different workbook) to my workbook.
Every time I try, I get a value error.
Bonus: I'm also trying to get the date that is closest to today's date, I have this formula here:
=IF(COUNT(G2:G5)>0,INDEX(G2:G5,MATCH(MIN(ABS(G2:G5-$D10)),ABS(G2:G5-$D10),0)),"")
Where D10 is just equal to =TODAY() and this entire formula works by pressing ctrl+shift+enter
If you can also include this into the formula so that it just spits out the closest date in G2 rather than spit out all the dates. But it is not necessary, just helps a lot.
For your "Closest to today problem", I was trying to spread the difference of the date or a comparison of the date just like in your example. This is just not working out. I solved the problem by adding another column. I do not know if this is a valid option for you or not, but here is what I have. Assuming H is available or you can insert a new column H. use this dragged down for each row - in your exampl 2 thorugh 5.
=ABS(D$10-G2)
Then add this in H10 or wherever you see fit
=D10-(MIN(H2:H5))
Here is an excel-ish example
5/12/2014 =ABS(D$10-G2)
5/13/2015 =ABS(D$10-G3)
5/14/2014 =ABS(D$10-G4)
5/15/2014 =ABS(D$10-G5)
6/6/2016 =D10-(MIN(H2:H5))

Concatenated VLookup comparison for conditional Formatting

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"!

How to display rows that contain data present in several columns (Excel and/or Google Spreadsheet)

I've been searching for a solution to my problem for days and haven't had any luck. Maybe I simply can't manage to search for the right wording for this problem but hopefully somebody will understand me here.
I'm having difficulties displaying data that is present in several columns at the same time, in my case the data to be displayed are trading days for various stocks. As the trading days vary between stocks I would like to have a column that displays the dates present in all other columns to only see trading days in common for all stocks.
I apologize if I'm unclear as this is my first question here. If anyone could point me in the right direction I would greatly appreciate it.
Here's the google spreadsheet link so you can see what I mean by different amount of trading days. The idea is to have column A display dates which are present in columns B,F,J,N,R,V at the same time but not show the other ones.
https://docs.google.com/spreadsheets/d/19GsIAtEdWPGcBfNOPaeqNVB7QQNO-bOyg-dCZzDaGkQ/edit?usp=sharing
EDIT: To show the desired output I'm looking for, here's another example:
https://docs.google.com/spreadsheets/d/1jrIqaEzDPWcW4hkF2YdHq9XYIWjG8PhrewYrBHqEdVY/edit?usp=sharing
The dates are automatically pulled from google finance. As the various exchanges are open on different dates, each stock has a varying amount of open days in columns B-E.
What I'm trying to do is have a formula in Column A that checks all the other columns and returns the data (in this case the date) that appears in every other column, discarding the data that doesn't appear in all other columns. For example 3/9/2013 appears in all columns B-E therefore it is shown, however 12/09/2013 doesn't appear in column B therefore it isn't shown.
Cheers
your dates are in european (UK) style, ie: 31/12/2014 but your spreadsheet is saved as US standard. This will cause some dates to be stored as text, as they are considered invalid. Ti will also couse unexpected results if you try to do any calculations or comparisons using your data. Go to File -> Spreadsheet settings and under locale choose correct country.
Then select all date columns, and click format->number->date or click the 123v button on tool bar, and choose date.
to simplify your problem:
for a value to be repeated across all 6 columns, that value must appear in column B.
you therefore want column A to contain the value of the adjacent cell in column B, if that value also appears anywhere in column F,J,N,R and V.
to check if value of B4 appears in column F you can use COUNTIF function. If the result if >0, than value of B4 appears in column F. Repeat for all columns and combine to achieve the following formula (to go in cell A4) :
=if(countif(F:F,B4)*countif(J:J,B4)*countif(N:N,B4)*countif(R:R,B4)*countif(V:V,B4),B4,)
now copy this formula down, and only dates that appear in all columns will be displayed in column A.
Use IF and COUNTIF. I think this is what you are looking for.
IF(COUNTIF(B4:V4,B4)=6,B4,NA())

Cells Defaulting to Original Formula if Blank

Hello and thank you for taking the time to read (and answer) my question.
I'm trying to create a data spreadsheet where one of the functions is to populate a series of columns with dates (added days, ie. 15 days, 7 days, etc.) based on the originally entered date (let's call that Date A, with the series of dates as Date B, Date C, etc.). Each following date down the series is added from its predecessor, so Date B is 14 days from Date A, Date C is 7 days from Date B, and so forth. Pretty easy stuff by simply using =A1+XX where XX is the number of days, etc.
The dilemma:
Each of the dates must have the capability to be manually overridden, with the dates in the series to reflect that change. In other words, if there's a 15 day count between Date B and C, and Date B was manually overridden from 1/1/2014 in and changed to 1/15/2014, then Date C should also change from 1/15/2014 to 1/30/2014
If a user was to change his mind and delete the manually entered date, it should revert back to using the original formula to acquire a date. Another words, if the user was to simply delete the data from the cell, ie. the cell is blank, the original formula should now be back in place to acquire data.
I'd also like to highlight any of the dates generated by a formula to be bold-italicized and a different color as well (ie. blue)
I managed to get the color change and the formulas all layed out, but I'm not sure how I can bring back the formula if manual data is entered and then deleted. I assume an IF ELSE can do this via VBA, but not sure how.
Can anyone help? Thank you in advance!
One way to do this without using VBA is this.
You can put one cell (I am calling this "manual override cell" or MOC) next to the cell where the formula is placed (formula cell or FC). If the user wants to input, he can input in the MOC. The FC then would contain an isblank function which checks if the MOC contains any value. If there is a value, that value overrides the output of FC. If the MOC is blank, then the formula overrides.
Something like =if(isblank(MOC),(FC-1)+xx,MOC) where (FC -1) is the previous value of FC in the series.
Does this work?

Resources