If begins

Shrinivas

New Member
Joined
Aug 17, 2006
Messages
8
I have 2 questions.
No 1-
Cell A1 contains numbers up to 10 digits. If number starts with 75 then B1 should return to YES.

No 2- in Cell value in A1 is greater than 750000 & less than 8000000 then B1 should return to YES

Thanks in advance,
Shrinivas
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi, maybe..

1. =IF(AND(A1<10000000000,LEFT(A1,2)="75"),"Yes","No")
2. =IF(AND(A1>750000,A1<8000000),"Yes","No")
 
Upvote 0
VBA solution:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    Application.EnableEvents = False
    If Left(Range("A1"), 2) = "75" Then
        Range("B1") = "YES"
    ElseIf Val(Range("A1")) > 750000 And Val(Range("A1")) < 8000000 Then
        Range("B1") = "YES"
    Else
        Range("B1") = "NO"
    End If
    Application.EnableEvents = True


End Sub
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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