Excel - Self reference a cell in conditional formatting - excel

I am trying to create a conditional format formula to colour a cell based on the value of itself, the cell next to it on the right, and whether the cell on the first row in the same column is a weekday or not.
Currently it works correctly as follows:
=AND($A$2=0,$B$2=0,WEEKDAY($A$1)<>1,WEEKDAY($A$1)<>7)
I have a lot of cells I'd like to use this formula in, so I thought about creating a cover-all formula that used the ADDRESS function.
My original idea was to use:
=AND((ADDRESS(ROW(), COLUMN()))=0,$B$2=0,WEEKDAY($A$1)<>1,WEEKDAY($A$1)<>7)
(I've changed just one cell reference here for example, but I'd like to change all 4 if possible).
However, when I try to use ADDRESS(ROW(), COLUMN()) in place of an absolute cell reference, the formula doesn't format the cell anymore.
Is there a way to make this cover-all formula work so that I don't have to go through and change the referenced cell values each time for every cell? Am I missing something about the syntax? Or will this simply not work the way I'd like it to? Thanks in advance!

ADDRESS returns a string that looks like a cell address and "$A$2"<>0.Wrap the ADDRESS in INDIRECT or rewrite your original without absolute rows.
=AND(indirect(ADDRESS(ROW(), COLUMN()))=0, indirect(ADDRESS(ROW(), COLUMN()+1))=0, WEEKDAY($A$1)<>1, WEEKDAY($A$1)<>7)
=AND($A2=0, $B2=0, WEEKDAY($A$1, 2)<6)

Related

Auto Copy and Paste Cell Values not Formula to another Cell

I also need to get your help for the same issue. I need to copy the cell values and not the formulas automatically to the other Cell, "automatically" meaning, I don't need to click, use mouse, or any other means to do that, like once theres a value on that specific cell (which is derived from a formula), the value will automatically be copied and pasted in the other cell (without any intervention from my part) (Only the value is copied not the formula)
Note:
The cell should contain only the copied value and not the formula.
Scenario:
A1 Cell : has 250 value
B1 Cell : has a vlookup formula to search for the value of A1 cell (I need to use VLOOKUP as there's a lot of items in the list, and it is "Dynamic", the reason I cannot just use formula "=A1" to get the value directly)
C1 Cell : Needs to copy and paste only the plain value from B1 cell which is 250, not including the vlookup formula, it should be automatically copied without any intervention (Cannot use VBA code / Macro as it will be run in excel online)
Thanks!!
Just use abasic Excel formula.
Example:
The source data is in cell A1.
You want to copy the same value to cell B1.
In cell B1 write:
=A1
That is all.
Additionally, you need to configure correctly the strategy for calculating the formulas:
I managed to find a solution, sharing as might help someone in the future, just needed to use =value(A1), instead of just "=A1", when I did this, the chart can read the values as it is and not the formula behind it. Found another work around as well, by using the formula =A1+0, for some reason this works too. –
=value(A1) works perfectly , If that formula contains a % figure , simple We can multiply by 100 to get the correct value.

Display the value from the formula ONLY if another cell has the value that I want

I've devised a formula that I want my cells to have, but I only want the value to show up if ANOTHER cell is populated with the value that I want.
My current formula is below:
=COUNTIFS($R$3:R21, "Brain")
However, this formula doesn't check whether or not the other cell has the value that I want to check for.
I put together a formula that I thought would check for whether or not the cell is populated:
=COUNTIFS($R$3:R21, "Brain", R21, "Brain")
Unfortunately, this formula doesn't work (it returns #VALUE!). I think it fails because R21 is already included in the COUNTIFS.
I also tried this similar formula, which also failed to work:
=COUNTIFS($R$3:R21, "Brain", R21:R21, "Brain")
I looked online and I found this possible solution:
=IF(ISNUMBER(SEARCH("Brain",R21)),"COUNTIFS($R$3:R21, 'Brain')","")
Unfortunately, this formula displays the text of the formula I want, and not the actual value of the formula.
Does anyone know how I could display the value from the formula ONLY if the cell I'm checking has the value that I want? Thanks.
Try
=IF(ISNUMBER(SEARCH("Brain",R21)),COUNTIFS($R$3:R21, 'Brain'),"")

Using the reference of one cell to create relative references

My P11 cell references another cell:
=J14
And I want to reference the reference in the P11 cell in multiple other cells. EX:
=OFFSET(J14,0,-4)
=OFFSET(J14,0,1)
=OFFSET(J14,0,2)
Except the "J14" in the OFFSET formula would ideally have a reference that grabs the reference of the P11 cell because I'm going to need to change that reference every time I do it. It would therefore be helpful to grab the reference of the P11 cell so that I only need to change the reference of one cell instead of 4.
I spent about an hour googling this but I just can't seem to find anything. If you guys could help that would be great because I just can't find a solution!
Assuming in cell P11 you have the formula =J14 you can use a combination of FORMULATEXT, INDIRECT, and SUBSTITUTE to get the cell reference. I am assuming the formula in cell P11 will only ever be a reference to a single other cell (e.g. =J14 or =M10 or =N14). If this is not true and the formula will ever be more complex than referencing one cell, this method will not work.
First we can use =FORMULATEXT(P11) to get the text of the formula in cell P11. The result of this is =J14. In order to be a valid cell reference we must remove the equal sign, which we can do by applying the SUBSTITUTE function like this:
=SUBSTITUTE(FORMULATEXT(P11),"=","")
The result of this is J14 which is a valid reference we can pass into the INDIRECT function to get what we are ultimately after.
So finally, in each of your offset formulas you would have:
=OFFSET(INDIRECT(SUBSTITUTE(FORMULATEXT(P11),"=","")),0,-4)
=OFFSET(INDIRECT(SUBSTITUTE(FORMULATEXT(P11),"=","")),0,1)
=OFFSET(INDIRECT(SUBSTITUTE(FORMULATEXT(P11),"=","")),0,2)
The benefit of this method is that you only need to change the formula in cell P11 and it does not rely on intermediate cells.
I hope this helps, if it doesn't and you can clarify your issue I can give another try.
You would want to use the INDIRECT() in conjuntion:
In another empty cell, lets say Q11 you would put in the cell reference as a string P1.
Then the following formulas in their various cells:
=INDIRECT(Q11)
=OFFSET(INDIRECT(Q11),0,-4)
=OFFSET(INDIRECT(Q11),0,1)
=OFFSET(INDIRECT(Q11),0,2)
A couple of words about these two formulas, they are Volatile functions. That means that they recalculate every time excel recalculates whether the data to which they refer change or not. So if you have a sheet full of them it will make a noticeable change in the calculation times. Only have four would not be noticeable.

Checking cell value dynamically

What I'm doing is a simple map on one tab of an office space that has all the cubicals laid out. On this map, I have conditional formatting checking another table of listen computers for the last time they were updated/maintained. It works as it stands, but we are moving into a new building and the map (which is already done) has WAY more cubes than last time. So I'm trying to figure out a more efficient way to do this task.
Here is the code:
=AND(VLOOKUP("CCA C1",LOCATION,3,FALSE)<>"",VLOOKUP("CCA C1",LOCATION,3,FALSE)<TODAY()-80)
So as it sits, it works fine. But what I'm trying to do is change the "CCA C1" to simply read the contents of the cell it's formatting so I can just format an entire range of cells rather than doing it cell by cell. The "CCA C1" is in the location of the second sheet (it's a named range). So this checks that entire range for "CCA C1" and checks if the date a couple columns over in that row is within 80 days, if it's not it highlights the cell in the map in red reminding us we need to check the computer. But what I would like to do is simply put "CCA C1" in the cell in the map (which is already is labeled), and have this check for the value of the cell it's formatting and look for that value the same way it's looking now. Just without me having to put "CCA C1" in the formula, I'd like to say something like this:
=AND(VLOOKUP(CURRENT CELL VALUE,LOCATION,3,FALSE)<>"",VLOOKUP(CURRENT CELL VALUE,LOCATION,3,FALSE)<TODAY()-80)
Make sense? Anyone know of a way to do this? Otherwise I have to conditionally format each individual cell with the value manually rather than just format all the cells with the same formatting and have the formula check the contents of the cell for what to look for in the location range of the other sheet.
And to clarify, I know that I can put in the actual cell, such as E3, but then I still have to manually change the formula for each cell which defeats the purpose. I want to just say current cell or something like that. I have 3 conditional formats for each cell, I have around 100 cells to be formatted, so rather than having 300 formats I have to put in, I'd love to just do 3. Not sure if this is possible, that's why I'm asking :)
Just replace "CCA C1" with the address of the first cell in the range of cells with the conditional formatting. Assuming your conditional formatting starts in B2:
=AND(VLOOKUP(B2,LOCATION,3,FALSE)<>"",VLOOKUP("CCA C1",LOCATION,3,FALSE)<TODAY()-80)
EDIT: As I commented, I'm not sure I understand the issue, but if I do, you need to enter the range of cells with CF in the applies to range of the CF dialog, rather than copying and using Paste Special:
Note that this works with the merged cells.
You will need to adjust the applies to range as you add more computers, etc., but the same formula will work.

Use cell value as part of a reference to a cell range in a formula

My problem is similar to that in this quesion: Row in formula change based on value in another cell, i.e. I want to use the value of a cell as reference to another cell in a formula of yet another cell.
However, I want the value of a cell to only be the part of a cell range. Let me give you an example:
A1 holds worksheet-a
In C1 I'd like to have a forumla that results in =SUM('worksheet-a'!B:B)
Based on the other question, I thought that something like =SUM(INDIRECT(A1)&"!B:B") might do it. Sadly, it does not.
Do you have any ideas?
Thank you!
For me it works in this way
=SUM(INDIRECT(CONCATENATE(A1;"!B:B")))
or with ampersand
=SUM(INDIRECT(A1&"!B:B"))

Resources