ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   checking the content of a cell if it starts with certain character (https://www.excelbanter.com/excel-programming/394548-checking-content-cell-if-starts-certain-character.html)

Timur

checking the content of a cell if it starts with certain character
 
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

Bernard Liengme

checking the content of a cell if it starts with certain character
 
=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
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Timur" wrote in message
...
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




Gary''s Student

checking the content of a cell if it starts with certain character
 
Sub timur()
v = Selection.Value
If Left(v, 2) = "PN" Then
MsgBox ("found PN")
End If
End Sub
--
Gary''s Student - gsnu200735


"Timur" wrote:

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



All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com