checking the content of a cell if it starts with certain character

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to calculate something if the content of the reference cell begins
with "PN"
I tried to use "if" formula as below ;
if A2=PN# or * but it did not work

I will be gled if somebody help me
thanks
timur
 
=IF(LEFT(A2,2)="PN",B2*3,"no way")
=IF(LEFT(A2,2)="PN",B2*3,"")

But IF is not needed if you can live with zero when there is no PN
=(LEFT(A2,2)="PN")*(B2*3)

best wishes
 
Sub timur()
v = Selection.Value
If Left(v, 2) = "PN" Then
MsgBox ("found PN")
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top