admin管理员组文章数量:1397142
I cannot figure out the correct syntax to get the conditional formatting I need in google sheets. In sheet1 I have column B with header name Count and then a sequence of 1 to 100 in the rows. In sheet2 I some other counts to create a total. The condition I need to check against is COUNTIF('sheet2'!$B:$B,"mytotal"). (I've named this cell CurrentTotal). I want to turn the cell in sheet1 red based on what my total is.
I have tried various custom formula conditional rules but I haven't managed to find anything that works either by referencing the COUNTIF formula or the named cell (with or without using INDIRECT). What should be the correct setup I should be using to get this to work?
Sheet1.
| Count | | 1 | | 2 | | 3 | | 4 | | 5 |
Sheet2. This is a column of info. The important bit is the count of instances of mytotal.
| Total | | mytotal | | mytotal | | x | | y | | mytotal |
So the countif will be 3 so sheet1 should have the 3 highlighted. If sheet2 gets updated to have an extra mytotal then the highlight on sheet1 should move to 4.
I cannot figure out the correct syntax to get the conditional formatting I need in google sheets. In sheet1 I have column B with header name Count and then a sequence of 1 to 100 in the rows. In sheet2 I some other counts to create a total. The condition I need to check against is COUNTIF('sheet2'!$B:$B,"mytotal"). (I've named this cell CurrentTotal). I want to turn the cell in sheet1 red based on what my total is.
I have tried various custom formula conditional rules but I haven't managed to find anything that works either by referencing the COUNTIF formula or the named cell (with or without using INDIRECT). What should be the correct setup I should be using to get this to work?
Sheet1.
| Count | | 1 | | 2 | | 3 | | 4 | | 5 |
Sheet2. This is a column of info. The important bit is the count of instances of mytotal.
| Total | | mytotal | | mytotal | | x | | y | | mytotal |
So the countif will be 3 so sheet1 should have the 3 highlighted. If sheet2 gets updated to have an extra mytotal then the highlight on sheet1 should move to 4.
Share Improve this question edited Mar 27 at 9:18 Graham Pursey asked Mar 26 at 20:28 Graham PurseyGraham Pursey 32 bronze badges 3- Welcome to StackOverflow! Please provide a minimal reproducible example in the form of markdown tables containing your sample input data and desired output. You may create one with the help of this link. – PatrickdC Commented Mar 26 at 21:50
- please place it on your posted question and not in the comments section. – PatrickdC Commented Mar 26 at 22:04
- Your sheet 2 is a bit unclear. Please consider editing the question again so that others, who may be confused, can understand it. – Gyul Commented Mar 26 at 22:22
1 Answer
Reset to default 1You're very close. Remember that custom formulas for the conditional formatting criteria are evaluated for each cell that the rule is being applied to and the formula needs to return TRUE/FALSE.
Also, in order to reference a range on another sheet, you need to use INDIRECT.
In your case, you are applying the rule to Sheet1!B2:B, so writing the custom formula from B2's perspective gives:
=B2=COUNTIF(INDIRECT("Sheet2!B:B"),"mytotal")
本文标签: Google Sheets Conditional Formatting of a column based on formulaStack Overflow
版权声明:本文标题:Google Sheets Conditional Formatting of a column based on formula - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744126541a2591976.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论