LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Problem with if statement

I thought this should be pretty simple. I basically just want a count of how
many meet a certain criteria in a column. But I am getting really weird
results!

I wrote the following code to pick up only information if there was an FO or
FR in column 22 and if column 5 had a range of 0-150, if all this critereia
is met I want it to go to column 17 and count how many in this column show a
number greater than 1. The next if statement says if colum 18 has a number 1
count how many, the same for column 19, again another if statement. The next
two if statements say if there is an X in column 12 count how many - this
one is not working at all. I want the next if statement to count any cells
that are not blank. The next if doesn't work either, I am trying to get it
to pick up anything that isn't blank in the column, there could be numerous
letters so I thought that would be the easist way.

Do I have to many if statements? The first three are doubling the numbers or
worse. I am getting bigger numbers every time I run it. What am I doing
wrong?


Dim 150DEL30, 150Del60, 150DelNA, 150CO As Long

For Each cell In Range("NoteList")

If cell.Offset(0, 22) = "FO" Or cell.Offset(0, 22) = "FR" Then
If cell.Offset(0, 5) "00" And cell.Offset(0, 5) < "150" Then
Select Case cell.Offset(0, 2)
Case 600 To 606

If cell.Offset(0, 17) = 1 Then
150DEL30 = 150DEL30 + 1
End If
If cell.Offset(0, 18) = 1 Then
150DEL60 = 150DEL60 + 1
End If
If cell.Offset(0, 19) = 1 Then
150DEL90 = 150DEL90 + 1
End If
If cell.Offset(0, 12) = "X" Then
150NA = 150NA + 1
End If
If cell.Offset(0, 23) < " " Then
150CO = 150CO + 1
End If
End Select
Next Cell
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF Statement problem MarkFrost39 Excel Worksheet Functions 3 September 6th 07 07:54 PM
Problem with If Statement MarkFrost39 Excel Worksheet Functions 0 September 6th 07 02:52 PM
IF Statement problem MarkFrost39 Excel Worksheet Functions 0 September 6th 07 02:50 PM
IF statement problem Ross Excel Discussion (Misc queries) 6 July 13th 06 04:47 PM
If Statement Problem TB via OfficeKB.com Excel Worksheet Functions 2 June 29th 05 10:03 PM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"