0

How can I create a function to be used in a conditional logic statement to act as a result?

Conditional logic statement: =IF(COUNTIFS(B10:B147,">20")=0,"Ok",function()) Result2[function()]: Change each cell B10:B147 to red if value within cell is over 20.

Community
  • 1
  • 1
  • You want to change a cell to be red if it's value is over 20? Why do you need a "function" for that? I guess maybe I'm not following what you are trying to do here. "A function to act as a result" could use some clarity. – JNevill Mar 14 '18 at 20:10
  • you could apply conditional formatting within the spreadsheet to do this... if you *need* it to be through vba, see: https://stackoverflow.com/questions/13661965/conditional-formatting-using-excel-vba-code – Cyril Mar 14 '18 at 20:13
  • @JNevill I need a function so that I may stretch my brains. Conditional formatting is fine if I needed to get this work done in a hurry. I started playing around with the CountIfs and If statements in Excel and thought it may be possible to change a group of cell's color within a If statement. – user9493741 Mar 15 '18 at 12:04
  • @JNevill Within the If statement there is a true and untrue result from the conditional logic statement that is shown in the cell the If statement is entered into. In my CountIfs statement above the "Ok" is the false and the "nOt Ok" is the true. – user9493741 Mar 15 '18 at 12:12
  • You can't change a cells properties through a sheet formula even if it calls a VBA function. So I think conditional formatting is the way to go here. – JNevill Mar 15 '18 at 12:24
  • As an alternative, you could write a VBA subroutine on the Worksheet_Change() event that tracks that cell and changes it (or other cell's) properties. But it won't be obvious from the front end what it's doing. – JNevill Mar 15 '18 at 13:23
  • @JNevil I surmise you are correct. I am not sure at this point how to do it. – user9493741 Mar 15 '18 at 16:03

0 Answers0