ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check if cell value is between two numbers (https://www.excelbanter.com/excel-programming/412364-check-if-cell-value-between-two-numbers.html)

Les

Check if cell value is between two numbers
 
Hi all,

I have a list of code numbers, 8 digits each in column A, formated as Text.

I need to do a look up to another sheet and if found bring in a department
code, but i must first check if the value per cell in column A is between

1. 10000000 and 13609999, then between
2. 00100000 and 00139999 and then lastley between
3. 00001000 and 00001399

If not then my code

Any help would be much appreciated.

--
Les

Gord Dibben

Check if cell value is between two numbers
 
Les

The data is Text.

There is no "between" for text as there would be for numbers.


Gord Dibben MS Excel MVP

On Tue, 10 Jun 2008 15:16:00 -0700, Les wrote:

Hi all,

I have a list of code numbers, 8 digits each in column A, formated as Text.

I need to do a look up to another sheet and if found bring in a department
code, but i must first check if the value per cell in column A is between

1. 10000000 and 13609999, then between
2. 00100000 and 00139999 and then lastley between
3. 00001000 and 00001399

If not then my code

Any help would be much appreciated.



Libby

Check if cell value is between two numbers
 
You could perhaps use something like this?
check1 = False
Check2 = False
check3 = False
If Int(myNum) = 10000000 And Int(myNum) <= 13609999 Then
check1 = True
ElseIf Int(myNum) = 100000 And Int(myNum) <= 139999 Then
Check2 = True
ElseIf Int(myNum) = 1000 And Int(myNum) <= 1399 Then
check3 = True
End If
If check1 = False And Check2 = False And check3 = False Then
'run your code
End If


"Les" wrote:

Hi all,

I have a list of code numbers, 8 digits each in column A, formated as Text.

I need to do a look up to another sheet and if found bring in a department
code, but i must first check if the value per cell in column A is between

1. 10000000 and 13609999, then between
2. 00100000 and 00139999 and then lastley between
3. 00001000 and 00001399

If not then my code

Any help would be much appreciated.

--
Les


Gord Dibben

Check if cell value is between two numbers
 
Well done Libby

Gord

On Tue, 10 Jun 2008 15:58:00 -0700, Libby
wrote:

You could perhaps use something like this?
check1 = False
Check2 = False
check3 = False
If Int(myNum) = 10000000 And Int(myNum) <= 13609999 Then
check1 = True
ElseIf Int(myNum) = 100000 And Int(myNum) <= 139999 Then
Check2 = True
ElseIf Int(myNum) = 1000 And Int(myNum) <= 1399 Then
check3 = True
End If
If check1 = False And Check2 = False And check3 = False Then
'run your code
End If


"Les" wrote:

Hi all,

I have a list of code numbers, 8 digits each in column A, formated as Text.

I need to do a look up to another sheet and if found bring in a department
code, but i must first check if the value per cell in column A is between

1. 10000000 and 13609999, then between
2. 00100000 and 00139999 and then lastley between
3. 00001000 and 00001399

If not then my code

Any help would be much appreciated.

--
Les




All times are GMT +1. The time now is 01:16 AM.

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