I have two columns to compare. All cell values come from the ROUNDUP function. =ROUNDUP(C6/D12,0) etc.
I want the larger, or equal, of the two in each row to be green and the smaller red. Using the formula, it does not work as expected. If I do the same with numbers typed, not the formula, it works. It appears the formatting applies to the formula and not the value.
That is the first half of the problem. I also want to autofill/paint the conditional formatting to numerous cells, but it always compares to the top left cell, rather than the two cells on the same row.
If I use the color scales formatting it works, but I do not want the scales, just red/green.
It seems hard to believe that what I want to do is not possible. Can someone please help me with this. Thanks in advance.
In conditional formatting, under 'use a formula to determine which cells to format', you need to enter
=A2=MAX($A2,$B2)
to highlight the larger cell and (as a separate rule)
=A2=MIN($A2,$B2)
to highlight the smaller cell.
Note that in the case where both cells have the same value, they will both be either coloured red or green depending on the precedence of the rules. If the 'green' rule comes first,
it will look like this:
Conditional formatting is almost its own little science within Excel. It may be more useful to find youtube tutorials on the topic than depend on a text explanation here. But the central theme is this.
You will use location locking (the dollar sign or F4) in front of the letters so that any cell to which the format is applied knows you specifically mean columns E and F, for instance.
Example: Assume your first row goes from A5 to M5, and the condition values are in E5 and F5.
I find it easiest to format one row with the rules I want, test them, and then use the format painter or copy -> paste format along with careful use of $ locking.
Drag over and select the entire row of cells A5:M5
Conditional Formatting -> New Rule -> Use a formula to determine which cells to format
In the formula field enter =$E5>$F5. Excel gets weird and often inserts double quotes. If you save the rule and go back in, it may say ="$E5>$F5" and if so delete the double quotes.
Click Format and create the cell format you want.
With A5:M5 still selected, add another rule and format for ="$E5<$F5"
The $ sign works the same way as it does in a formula. All of the columns get their format based on columns E and F, but all of the rows base their formula on the E and F values in that same row.
Im exploring how feasible it is to extract data from cells that consist of text. ultimately. I will apply conditional formatting rules based on the date relative to today, but right now I just need to be able to extract them.
So far I have achieved the following:
To achieve this I've used the formula found online =IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),""). The issue is that if a cell contains only a date, the Length is subtracted from itself and nothing is returned. I have tried modifying the above equation but keep running into errors.
Hoping someone may be able to help me out modify this formula. Alternatively, if anyone knows how dates can be extracted used just excel formulas that would be great.
The issue is that without the other text it is a true date and a true date is a double and has no - in it.
The simple fix is to wrap change the"" return from the IFERROR to B2:
=IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),B2)
If that is not sufficient you can do an IF to test if date:
=IF(ISNUMBER(B2),B2,IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),""))
This is a solution I came up with with appears to work for almost Any Date format provided the date is at the top of the cell. Note this was done for dates in cell H6 of my workbook.
The formula below can be entered below to extract the date from this cell amongst text.
=TEXT(IFERROR(LEFT(H6,SEARCH(CHAR(10),H6,1)-1),H6),"dd-mmm-yyyy")
This formula checks if the date is within 3 years and returns a true of false value. This can be used to conditionally Format Cells if the date once extracted is out of date.
=IF(ISBLANK(H6),FALSE,IFERROR(IF(DATEVALUE(TEXT(IFERROR(LEFT(H6,SEARCH(CHAR(10), H6, 1)-1),H6),"dd-mmm-yyyy"))<=TODAY()-(365*3),TRUE,FALSE),TRUE))
Works really well for me!
I have a column (I) that is a sum of total hours worked for a month. I'm trying to apply a conditional formatting rule that will highlight cells that equal 0 but aren't blank.
The formula I'm using is:
AND(I2=0,NOT(ISBLANK(I2)))
It highlights most of the 0 values (but not all of them) and it is also highlighting some non-zero values.
I don't know if will help, but this is a sample of what I'm getting:
I had a simmilar problem a few months ago. Mark Fitzgerald pointed out the right direction to me. Times in Excel are all percentages of days. Computers calculate in binary so all those decimals have to be converted to binary before the math operation and the result has to be converted back to decimal.
But decimal places are limited to 15 in Ms Excel. You can check the whole answer here.
I think your issue is the Applies to range (though I am surprised that the Total label is not then coloured blue). It seems to me the formatting is correct but offset by one row. For simplicity, I suggest selecting the entire Total column and applying:
=AND(I1=0,NOT(ISBLANK(I1)))
Or select the range to format starting in the first cell below Total (ie Row2) and apply your formula.
Taking the 'simpler' approach, if you don't want the label formatted you might give it a rule of its own, with No Format Set chosen and make sure it has priority (eg at the top of the list with Stop If True checked).
#Dimitrios has a point (but it seems also a solution) if the values are being calculated.
=AND(I2=0,NOT(ISBLANK(I2)))
Enter the conditional formatting as a formula into the first cell. Click 'Ok'. Then copy the first cell and paste special as "formatting" to the remaining cells.
This will work as you desire.
I'm looking for a formula to return one of six possible results based on which date (if any) is the highest out of all dates available that fall within a specific date range.
Consider the following layout:
Cell A1 has a fixed date (this is my lower constraint)
Cell A2 has a fixed date (this is my upper constraint)
Cells G5:K5 may contain dates or they may be blank.
If G5 and H5 both contain dates and both of those dates are between my dates in A1 and A2, then I want the result of my formula to identify which of those two is the most recent (it can show the date itself, the column header, a text string, doesn't matter as long as it is something different for each column)
If any of G5:K5 also contain other dates that fall outside of the window defined by A1 & A2 then those dates should be ignored.
If none of the dates are within the permitted range or all of the cells are blank then it can return a string like "not applicable" or an error that I can rewrite using IFERROR.
My dataset is pretty big (I'll be copying this formula down several hundred rows) so I would prefer to avoid using an {array} formula if possible - too slow. I've been staring at this worksheet long enough for my brain to have turned to mush, so if there is a straightforward approach to reaching my goal it is currently eluding me.
Any assistance greatly appreciated!
Figured it out in the end. It's not pretty, but it works.
This part returns the highest valid date:
MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))
And then by nesting it I can convert the results to a different text string depending on which column contains the "winner".
=IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=G5,G5<>""),"CA",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=H5,H5<>""),"MX",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=I5,I5<>""),"BR",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=J5,J5<>""),"IQS",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=K5,K5<>""),"Other","Not Applicable")))))
I think I understand now. The following formula will get you the maximum date in the range G5:K5, subject to the condition that it be between the dates in A1 and A2. It will return "not applicable in the event that none of the dates meet the condition.
=IF(COUNTIFS(G5:K5,">="&$A$1,G5:K5,"<="&$A$2)<5,LARGE(G5:K5,1+COUNTIFS(G5:K5,">"&$A$2)),"not applicable")
I have a big sheet with a lot of formulas that have a dependency hierarchy between them. It starts with a cell with a date value. Then, cell x:y (and others), has formula depending on this date. Then cell w:z (and others) has a formula depending on cell x:y. And so on...
This main cell with a date value is filled using apache poi.
And now my problem: when I open the generated excel file, the date is there, but none of the formulas are calculated. They all have the error "A value used in the formula is of the wrong data type". It seems that when the formula try to evaluate it self the date isn't there yet.
Solutions:
1) If I click in the cell, and just press ENTER, the formula is correctly evaluated. But then I would have to do this for all cells.
2) I click in the date cell, copy it, and then paste it in the same place, and all formulas in the sheet are evaluated!
3) I could iterate in all cells in my application, evaluating each one with evaluateFormulaCell method from FormulaEvaluator class. But I have a lot of formulas and the performance of this is terrible.
Does someone have a solution for this?
Thanks!!
Your date value isnt recognized by the excel formulas as a date, what you could do is have another cell dat will first take the datevalue DATEVALUE() of the cell filled using Apache poi.
Then direct your first level formulas to that cell instead of the one filled using Apache poi
Because Excel don't calculale automatically, so just change this.
Excel 2010: File -> Options -> Formulas: Find Workbook calculation, and change to Automatically.
It worked for me.
To solve this, I changed all formulas in my template, to use instead of the regular formula sintax (=SUM(A:D)) the following sintax:
$[SUM(A:D)]
http://jxls.sourceforge.net/reference/formulas.html