View Full Version : Problem about function reference

12-07-2016, 07:23 PM
Dear all member!
I was studying the application functions in Excel.
Currently I have a cell that says "number of cars:2".
I want to write something that makes it so that if the number of cars is less than 2, turn the cell red.
If it is greater than 2, turn the cell green.
Is there a way to reference just the number in the cell when writing an if statement.
If I can, how would I do so?

Thank's a lot!

12-07-2016, 11:43 PM
A better practice would be to use separate cells for description and for quantity. Text in one cell, "number of cars:", and the value 2 in another cell, such as the cell below or to the right.

If they must be combined as you describe, it is more difficult to process and maintain that. One way would be to identify the common rule of data. For example, with these cells in A1:A4
number of cars:2
number of cars:1
number of boats:1
number of bikes:2
If the "rule" is that the number follows the colon (":"), and there is never more than one colon, you might go
and copy down. However this type of approach with data can commonly lead to inconsistency and maintenance problems because the "rule" must be adhered to. So it's better to use separate cells.