Results 1 to 3 of 3

If statement user created function

Threaded View

demuro1 If statement user created... 10-10-2008, 10:28 PM
Paul Hi demuro, Try this... 10-11-2008, 12:56 AM
demuro1 are you saying that the... 10-11-2008, 03:19 PM
  1. #1
    Registered User
    Join Date
    08-27-2007
    Posts
    22

    If statement user created function

    so I am so new to VB it's lame but I have the following code

    Function Adjust(x)
        
    If (Range("Ref!$A$16") = 2 And Range("Ref!$A$29") = 1) Then
        
        If Range(x) > 20 And Range(x) < 86 Then
            x = x + 3
        ElseIf Range(x) > 87 And Range(x) < 453 Then
            x = x + 3
        ElseIf Range(x) > 454 And Range(x) < 807 Then
            x = x + 3
        Else
            x
        End If
        
    ElseIf (Range("Ref!$A$16") = 3 And Range("Ref!$A$29") <> 1) Then
    
        If Range(x) > 20 And Range(x) < 86 Then
            x = x + 3
        ElseIf Range(x) > 87 And Range(x) < 453 Then
            x = x + 29
        ElseIf Range(x) > 454 And Range(x) < 807 Then
            x = x + 136
        Else
            x
        End If
        
    
    
    ElseIf (Range("Ref!$A$16") = 3 And Range("Ref!$A$29") = 1) Then
    
        If Range(x) > 20 And Range(x) < 86 Then
            x = x + 6
        ElseIf Range(x) > 87 And Range(x) < 453 Then
            x = x + 132
        ElseIf Range(x) > 454 And Range(x) < 807 Then
            x = x + 639
        Else
            x
        End If
        
    Else: x
    
    End If
    
    
    End Function
    My question is I know it's not correct. "x" is going to be a cell in the range C11:C96 from the provided worksheet. C11:C96 will eventually be referenced on worksheet1 in column A.

    So I'm trying to make this work but I have no idea how to make excel let me use this function nor do I know if the code is correct.

    can anyone help me out?

    Thanks a million
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using the 'NOW' function within an 'IF' statement
    By rminns in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2011, 04:01 PM
  2. Modify a Function to add an extra condition
    By King_Quake in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2008, 04:32 PM
  3. User that created worksheet?
    By artolder in forum Excel General
    Replies: 2
    Last Post: 06-30-2008, 12:56 PM
  4. Compare user input with range (with an if statement)
    By HBF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2008, 11:35 AM
  5. Link together different cells in specific order?
    By Sandman4432 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 01-03-2008, 05:01 AM

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