CF for split numbers

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
395
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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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