Implement this IF Statement into Cond. Formatting. HOW?

Mister H

Well-known Member
Joined
Mar 6, 2002
Messages
1,507
Hi All:

I am wondering how I can put this If statement into Conditional Formatting:

IF(LEFT(B1,17)="Customer Balance:","DELETE",""))

I want to put in a condition that will simply say IF the above condition is met (first 17 letters = Customer Balance: then change the cell to Yellow

Hope this makes sense. I tried this in the Conditional Formatting but it did not work for me? I did not get an error (like the other fromulas I tried) but it did not turn my cell Yellow even though it started with Customer Balance:

=LEFT(B1,17)="Customer Balance:"

Any suggestions? :confused:

THANKS,
Mark :)
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
This worked for me:

Excel 2003<TABLE style="BORDER-RIGHT: #a6aab6 1px solid; BORDER-TOP: #a6aab6 1px solid; BORDER-LEFT: #a6aab6 1px solid; BORDER-BOTTOM: #a6aab6 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #ffffff" cellPadding=2 rules=all><COLGROUP><COL style="BACKGROUND-COLOR: #e0e0f0" width=25><COL></COLGROUP><THEAD><TR style="COLOR: #161120; BACKGROUND-COLOR: #e0e0f0; TEXT-ALIGN: center"><TH></TH><TH>B</TH></TR></THEAD><TBODY><TR><TD style="COLOR: #161120; TEXT-ALIGN: center">1</TD><TD style="BACKGROUND-COLOR: #ffff00">Customer Balance: 321312</TD></TR></TBODY></TABLE><TABLE style="BORDER-RIGHT: #a6aab6 1px solid; BORDER-TOP: #a6aab6 1px solid; BORDER-LEFT: #a6aab6 1px solid; BORDER-BOTTOM: #a6aab6 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #ffffff" cellPadding=2 rules=all><THEAD><TR style="COLOR: #161120; BACKGROUND-COLOR: #e0e0f0; TEXT-ALIGN: center"><TH>Sheet1</TH></TR></TD></THEAD><TBODY></TBODY></TABLE>
Custom Number Format:
Formula Is: =LEFT(B1,17)="Customer Balance:"
 
Upvote 0
THANKS MrKowz :)

I am not sure why it wasn't working for me but I closed Excel and tried again and it is now working. :biggrin:

When it didn't work for me the first time I just assumed I was missing something in the formula.

THANKS Again.

Have a GREAT day,
Mark :biggrin:
 
Upvote 0
Hi MrKowz (OR anyone that can assist :))

Can you tell me if there is a way that using conditional formatting (or VBA if needed) that I can search B1 and if it contains WD-CM it turns the cell RED?

The catch is that the WD-CM is not always going to be in the same spot so I can not specify the number of characters to match I just need it to search the entire cell and if that WD-CM appears somewhere in there then change the cell to RED?

Any suggestions? :confused:

THANKS,
Mark
 
Upvote 0
THANKS Peter :) That Works

Would I be able to use that same formula in VBA? If I needed to search from row 20000 UP is there an easy way to do that? I have not yet searched Mr Excel but I can if you can't provide a simple solution. I am asking because I have already used two of the conditions in Conditional Formatting and may need the 3rd for something else.

:confused: So, can VBA

check column B and wherever the WD-CM is found make the B Cell RED and maybe put "Do Not Review" in Column C (same row of course).

THANKS Again Peter,
Mark :)
 
Upvote 0
Hi Mark. Try this

Code:
Sub test()
Dim LR As Long, i As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    With Range("B" & i)
        If InStr(.Value, "WD-CM") > 0 Then
            .Interior.ColorIndex = 6
            .Offset(, 1).Value = "Do not review"
        End If
    End With
Next i
End Sub
 
Upvote 0
AWESOME. THANSK Peter.

Can you tell me what your formula is saying? I am not really sure of the >0

If InStr(.Value, "WD-CM") > 0 Then

:confused: Look in the Text String for the value WD-CM > 0 (so if WD-CM is not found then that would equal 0?)

Just trying to understand. THANKS. This bit of code is going to make sorting through this CRAPPY Report much easier :biggrin:

Take Care,
Mark
 
Upvote 0
InStr returns the position of a substring within a string or 0 if the substring isn't found. So if InStr returns a value >0 the substring exists.
 
Upvote 0
THANKS for the explanation Peter :biggrin:

I really APPRECIATE ALL your help now and in the past :)

Have a GREAT day,
Mark
:beerchug:
 
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,776
Members
452,942
Latest member
VijayNewtoExcel

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