if then

isacp

Board Regular
Joined
Dec 16, 2004
Messages
135
if cell contains xx then
can you help me with the wording of this code?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
=if(a1=13,"thirteen","not thirteen")

where a1 is the cell being evaluated, thirteen the value returned for true and not thirteen the value for false.
 
Upvote 0
Hi isacp,

If Cells(1,1) = "xx" Then
If Range("A1") = "xx" Then

look around in the codes all over the Board
use the "search" on top of the screen

You'll learn a lot

regards,
Erik
 
Upvote 0
Do you want code or formula?

Formula:

=IF(A1="xx", ReturnIfTrue, ReturnIfFalse)

Code:

IF Range("A1").Value = "xx" Then
'Do something if true
Else
'Do Something if False
End IF

HTH
 
Upvote 0
cell a1 "sprint"

if a1="sp" then

this wont work for thi example.
but this is what i need.
to chose two letters in a string
 
Upvote 0
If Left(Range("A1"), 2) = "xx" Then MsgBox "xx"
attention: this is casesensitive
if it may not be casesensitive
If LCase(Left(Range("A1"), 2)) = "xx" Then MsgBox "xx"
If UCase(Left(Range("A1"), 2)) = "XX" Then MsgBox "xx"


regards,
Erik
 
Upvote 0
Hi

try this

=IF(LEFT(A1;2)="sp";"You are lucky!";"Sorry. No match!")

Is this the exactly what are you looking for?
 
Upvote 0
Perhaps if the abbreviation is not at the begining of your text string:
Code:
If Instr(1,Range("A1"),"xx") > 0 Then
MsgBox "The string xx indeed appears in you search string."
End IF
HTH.
 
Upvote 0
for each item in selection
if item.Left(Range("A1"), 2) = "St" Then
item.offset (0,1).select
selection.copy range("a1")
end if
next item


will this work?
 
Upvote 0
If Item.Left = "O.D." Then
Item.Offset(0, 5).FormulaR1C1 = "O.D."
End If

this is what i have and it wont go?
 
Upvote 0

Forum statistics

Threads
1,224,800
Messages
6,181,045
Members
453,014
Latest member
Chris258

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