Results 1 to 6 of 6

If statement not adding up correctly

Threaded View

  1. #1
    Registered User
    Join Date
    03-16-2010
    Location
    Chesterfield, England
    MS-Off Ver
    Excel 2016
    Posts
    19

    If statement not adding up correctly

    Hiya all.

    I am writing a macro to look a value in one column (Difference) which then adds one onto the appropriate variable. It is semi working, but the macro is adding what should be going on the P and M variable and is adding it on to the W variable.

    Am i doing something completly silly? I cant seem to figure out what the problem is.

    Thanks for any help.


    If LOPNum > 0.5 Then
        PP = PP + 1
        Else
        If LOPNum = 0.4 Then
            P = P + 1
            Else
                If LOPNum = 0.3 Then
                P = P + 1
                Else
                    If LOPNum = 0 Then
                    W = W + 1
                    Else
                        If LOPNum = -0.3 Then
                        M = M + 1
                        Else
                            If LOPNum = -0.4 Then
                            M = M + 1
                            Else
                                If LOPNum <= -0.6 Then
                                MM = MM + 1
                                End If
                            End If
                        End If
                    End If
                End If
        End If
    End If
    Last edited by sted999; 07-19-2010 at 10:54 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1