ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If Not equal to statements (https://www.excelbanter.com/excel-programming/342801-if-not-equal-statements.html)

Erik K via OfficeKB.com[_2_]

If Not equal to statements
 
I am trying to create a statement to the affect of:

If Range("AB20").Value = "N" and Range("W12:W80").Value < "Abe" Then

I cannot get this statement to run. Is it not possible to create a "not
equal to" statement listing a string of cells? i.e. "W12:W80" ?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1

Norman Jones

If Not equal to statements
 
Hi Erik,

Try:

If Range("AB20").Value = "N" And _
Application.CountIf(Range("W12:W80"), "Abe") = 0 Then


---
Regards,
Norman



"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:55d07a8f5c4f4@uwe...
I am trying to create a statement to the affect of:

If Range("AB20").Value = "N" and Range("W12:W80").Value < "Abe" Then

I cannot get this statement to run. Is it not possible to create a "not
equal to" statement listing a string of cells? i.e. "W12:W80" ?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1




Bob Phillips[_6_]

If Not equal to statements
 
You can test one cell for a value in that way, but not all. If they all must
equal Abe, you could try

If Range("AB20").Value = "N" AND _
Application.Countif(Range("W12:W80","Abe") = 69 Then



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:55d07a8f5c4f4@uwe...
I am trying to create a statement to the affect of:

If Range("AB20").Value = "N" and Range("W12:W80").Value < "Abe" Then

I cannot get this statement to run. Is it not possible to create a "not
equal to" statement listing a string of cells? i.e. "W12:W80" ?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1




Erik K via OfficeKB.com[_2_]

If Not equal to statements
 
I don't want all the cells to equal "Abe", I am trying to set a condition
that if "Abe" is not found in a range of cells then do the next argument.
This is how I have it currently:

Range("V96").Select
If Range("AG42").Value = "N" Then
ActiveCell = "Shane"
ElseIf Range("AG18").Value = "N" And Range("V12:V80").Value < "Abe"
Then
ActiveCell = "Abe"
Else: ActiveCell = "Alternate"
End If

Bob Phillips wrote:
You can test one cell for a value in that way, but not all. If they all must
equal Abe, you could try

If Range("AB20").Value = "N" AND _
Application.Countif(Range("W12:W80","Abe") = 69 Then

I am trying to create a statement to the affect of:

If Range("AB20").Value = "N" and Range("W12:W80").Value < "Abe" Then

I cannot get this statement to run. Is it not possible to create a "not
equal to" statement listing a string of cells? i.e. "W12:W80" ?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1

Erik K via OfficeKB.com[_2_]

If Not equal to statements
 
I don't want all the cells to equal "Abe", I am trying to set a condition
that if "Abe" is not found in a range of cells then do the next argument.
This is how I have it currently:

Range("V96").Select
If Range("AG42").Value = "N" Then
ActiveCell = "Shane"
ElseIf Range("AG18").Value = "N" And Range("V12:V80").Value < "Abe"
Then
ActiveCell = "Abe"
Else: ActiveCell = "Alternate"
End If

Bob Phillips wrote:
You can test one cell for a value in that way, but not all. If they all must
equal Abe, you could try

If Range("AB20").Value = "N" AND _
Application.Countif(Range("W12:W80","Abe") = 69 Then

I am trying to create a statement to the affect of:

If Range("AB20").Value = "N" and Range("W12:W80").Value < "Abe" Then

I cannot get this statement to run. Is it not possible to create a "not
equal to" statement listing a string of cells? i.e. "W12:W80" ?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1

Bob Phillips[_6_]

If Not equal to statements
 


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:55d0f68112890@uwe...
I don't want all the cells to equal "Abe", I am trying to set a condition
that if "Abe" is not found in a range of cells then do the next argument.
This is how I have it currently:

Range("V96").Select
If Range("AG42").Value = "N" Then
ActiveCell = "Shane"
ElseIf Range("AG18").Value = "N" And Range("V12:V80").Value <

"Abe"
Then
ActiveCell = "Abe"
Else: ActiveCell = "Alternate"
End If

Bob Phillips wrote:
You can test one cell for a value in that way, but not all. If they all

must
equal Abe, you could try

If Range("AB20").Value = "N" AND _
Application.Countif(Range("W12:W80","Abe") = 69 Then

I am trying to create a statement to the affect of:

If Range("AB20").Value = "N" and Range("W12:W80").Value < "Abe" Then

I cannot get this statement to run. Is it not possible to create a

"not
equal to" statement listing a string of cells? i.e. "W12:W80" ?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1




Bob Phillips[_6_]

If Not equal to statements
 
Okay, so apply so logic to it and work out that instead of =69 the test
should be = 0

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:55d0f68112890@uwe...
I don't want all the cells to equal "Abe", I am trying to set a condition
that if "Abe" is not found in a range of cells then do the next argument.
This is how I have it currently:

Range("V96").Select
If Range("AG42").Value = "N" Then
ActiveCell = "Shane"
ElseIf Range("AG18").Value = "N" And Range("V12:V80").Value <

"Abe"
Then
ActiveCell = "Abe"
Else: ActiveCell = "Alternate"
End If

Bob Phillips wrote:
You can test one cell for a value in that way, but not all. If they all

must
equal Abe, you could try

If Range("AB20").Value = "N" AND _
Application.Countif(Range("W12:W80","Abe") = 69 Then

I am trying to create a statement to the affect of:

If Range("AB20").Value = "N" and Range("W12:W80").Value < "Abe" Then

I cannot get this statement to run. Is it not possible to create a

"not
equal to" statement listing a string of cells? i.e. "W12:W80" ?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1





All times are GMT +1. The time now is 02:32 PM.

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