I'm trying to have one column change color (individual cells in that column, rather) depending on if there is text in a different cell in the same row. I've tried using something along the lines of =IF(($B1<>""), TRUE, FALSE) and that works, but when I try to copy that formatting to the rest of the column, the cell number that the formula references stays the same, so every cell in column A will reference cell B1 instead of changing the reference cell to B2, B3, etc... on down the column.
The problem with your formula i'm assuming is the $ sign which is an absolute reference. So if you use $B1 in your formula, you're saying that you need to always compare against the value in column B.
using this formula should probably work for you:
=IF(B1<>"", TRUE, FALSE)
But it also depends on the range that you're applying this conditional-format on.
TIP:
You don't even have to use the IF function, B1<>"" returns TRUE or FASLE by default.
Related
How to write a formula in excel that based on critria it can check if list of multiple result cells have same value.
I attached example:
Look for all cell with the number 100
Verify that the list of these cells contain same date value of one cell.
I try to use formula such as: COUNTIF + INDEX and MATCH but didn't work as expacted.
I'm guessing you can use =ROWS(FILTER(....)) but what I would do is create a hidden column that evaluates it per row, maybe with something like
=IF(A2="","",XLOOKUP(A2,A$2:A,B$2:B)=B2)
and copy that formula down the column.
This way, you can not only see if there are any bad values (by COUNTIFS for false values where the A-column's value matches the "find these cells" value) but apply conditional formatting as well to highlight the bad values.
I am using the formula:
=(Cost!C8)
to get values from another sheet using named ranges. I want this to only show a value if there is a value in the corresponding cell of the other sheet, however, this formula returns a value of 0 even if the cell on the other sheet is empty. How can I make it so that the formula returns nothing (is blank) when the cell it refers to is empty?
Invoice
There are a number of ways to prevent zero's from showing when you refer to a blank cell.
The easiest if probably an IF statement. If your formula is:
=(Cost!C8)
...use:
=IF(Cost!C8="","",Cost!C8)
Similarly you could show a default value, or a label like <No Data> with a variation:
=IF(Cost!C8="","<No Data>",Cost!C8)
Note that Cost!C8 is not a Named Range; it's a cell reference, referring to another worksheet.
More Information:
Office Support : Create conditional formulas
TechRepublic : Three ways to hide zero values in an Excel sheet
Use,
=Cost!C8&""
'alternate for Qty
=TEXT(Cost!C8, "[<>0]0;;;")
'alternate for currency
=TEXT(Cost!C8, "[<>0]$ 0.00;;;")
'alternate for text items
=TEXT(Cost!C8, ";;;#")
Granted, this actually converts your true numbers to text-that-looks-like-a-number and that is generally a practice to be avoided but they will be converted back to true numbers through any maths operation like addition or multiplication.
A blank cell is considered numeric by nature. This can be tested with =ISNUMBER(<blank_cell>). The closest thing to a blank number is zero so you are returning those as the value of the blank cells you are linking to.
Use ISBLANK with IF
=IF(ISBLANK(Cost!C8),"",Cost!C8)
If you just want it to not be visible, you might consider using conditional formatting to make the text color white when the cell is equal to 0. This way the actual value remains 0 so it won't break downstream formulas.
A nice, slightly simpler, alternative is to concatenate the named range with an empty string.
=MyRange --> 0
=""&MyRange --> ""
This is equivalent to TEXT(MyRange) more concise than IF(ISBLANK(MyRange), "", MyRange)
I am trying to use a sumif where the criteria is that column B equals 1 or 11:
=SUMIFS(A:A,B:B,{1,11})
The formula above works perfectly. But now what I would like to do is store {1,11} in a cell (e.g. cell C1). Then:
=SUMIFS(A:A,B:B,C1)
This no longer works, and it seems to pull up C1 as "{1,11}". Even though there are no visible quotes in cell C1, when I highlight C1 and press F9 in the sumif formula, quotes do come up.
Is there any way to do this? I want to be able to set the array {1,11} as a variable in a separate cell, because this could change. I do not want it hardcoded within the sumifs formula.
Thanks!!
Place your desired lookup in C1 and down, this is dynamic
=SUMPRODUCT(SUMIFS(A:A,B:B,C1:INDEX(C:C,MATCH(1E+99,C:C))))
Just make sure there are no other numbers in column C and the list is contiguous.
One possibility is you can use text in C1:
'{1,11}
And then define a name to convert it to an array:
EvalC1 refers to
=EVALUATE($C$1)
Note you can use the name in your array formula:
=SUMIFS(A:A,B:B,EvalC1)
I have a excel formula which correctly returns true. But when I used the same formula in conditional format, I am not able to get the conditional format. Please help.
=AND(FIND("MyText",INDIRECT(ADDRESS(1,COLUMN()))),INDIRECT(ADDRESS(ROW()+2,COLUMN()))=1)
If the first cell of the column is "My-text" and the value is 1 (in row +2, same column) the formula correctly returns true. If I used it in a conditional format to paint a fore-ground color it is not working. I also tried search and searchb. But didnt work. The format of the cell (row() +2, column) that might have value 1 is "General"
If you change to R1C1 reference style, you can enter the formula as =AND(R1C="MyText", R[2]C=1)
R1 means row 1, C means same column, and R[2] means 2 rows below the current cell.
In A1 reference style, the formula will depend on the currently active cell, so if for example the active cell is A1, the formula will be =AND(A$1="MyText", A3=1)
Not sure why this wouldn't work. But you can simply replace the AND function with *. Here is what you can try:
=FIND("MyText",INDIRECT(ADDRESS(1,COLUMN())))*INDIRECT(ADDRESS(ROW()+2,COLUMN()))=1
I changed the AND into following and it worked. But not sure what is the issue with AND in conditional format
=NOT(ISERROR(SEARCH("MyText",INDIRECT(ADDRESS(1,COLUMN())))))
*INDIRECT(ADDRESS(ROW()+2,COLUMN()))
Added the above answer for reference.
I have a list of students who are between the ages of 3 and 5. lets say column A has the code, Column D has the childs age & Column F has their age group (3-5) If their age exceeds the age group then the Cell in column A will highlight Red. I am just not sure how to write this code correctly, all of the combinations i have tried come up with an error or just don't do anything.
IF(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5" & (OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5 {THEN FILL CELL RED} {ELSE NO FILL}
In the first part of the statement you are checking whether the cell 7 columns across = "3-5". You don't need to use offset for this, you can just reference the cell 7 across directly.
So if you're applying the conditional formatting to A1 that part of the formula would just be =IF(H1="3-5",{then},{else}).
If you just want TRUE or FALSE as the answer you don't need the IF statement, so this shortens to: =H1="3-5",
If you're applying the conditional formatting to a range instead of just an individual cell, say A1:B10, then you write the formula for the cell in the top left of the that range. So for A1:B10 you would still you the same formulae as above.
For the second part of the statement, using the same logic as above, you get: =E1>5
To check both statements together you need to wrap them in the =AND() function, giving you this as the final formula for your conditional formatting:
=AND(H1="3-5",E1>5)
By using the AND function I can achieve the desired result without cell references moving if a cell is relocated.
=AND(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5yo",OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5)