CF for split numbers

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
389
Office Version
  1. 2016
Platform
  1. Windows
Great day Experts,

I am looking for a CF formula that will check if one side of a number is greater than the other side. The formula I was attempting to use was IF(left(A2,1)>right(A2,1),true,"") to turn red and IF(left(A2,1)<=right(A2,1),true,"") to turn green. The issue I ran into is that this formula only works 1 character. Is there a better way to achieve what I am trying to do?


Book1
ABC
27/48/135/9
Sheet1
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
When you are writing formulas for CF you don't need to explicitly return TRUE. Write a Boolean condition that evaluates to TRUE or FALSE.

I would first color all cells green as a default. Then you only need a single CF rule to turn some red:
Excel Formula:
=LEFT(A1,FIND("/",A1)-1)>MID(A1,FIND("/",A1)+1,99)

$scratch.xlsm
ABC
17/48/135/9
split numbers
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:C1Expression=LEFT(A1,FIND("/",A1)-1)>MID(A1,FIND("/",A1)+1,99)textNO


[Later versions of Excel can use TEXTBEFORE and TEXTAFTER instead of LEFT, MID, and FIND]
 
Upvote 1
Another option
Fluff.xlsm
ABC
1
27/48/135/9
Data
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C2Expression=LEFT(A2,FIND("/",A2)-1)+0>REPLACE(A2,1,FIND("/",A2),"")+0textNO
 
Upvote 1
Solution
@6StringJazzer, I took your advice on making the area green. Thank you
@Fluff Thank you for the second option, gratefully appreciate it.

In the event that I wanted to have the reverse version of this formula where it turns green due to the right side of the / is greater than the left. How would I change the formula for it wo work?
Thank you in advance.
 
Upvote 0
One way:

Book1
ABC
1
27/4 8/13 5/9
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C2Expression=--("0 "&A2)>1textNO
 
Upvote 0

Forum statistics

Threads
1,222,182
Messages
6,164,436
Members
451,895
Latest member
donnykonny

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top