Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    5

    Unanswered: convert excel function to vba

    I need to write the following function used in an excelsheet in vba, but my knowledge of excel is to weak to understand fully the formula. Can anybody help me ?

    function:

    =IF(AND(B31<TODAY();B32<TODAY();B33<TODAY();B34<TO DAY();OR(ISBLANK(B36);B36=2));2;IF(AND(B31<TODAY() ;B32<TODAY();B33<TODAY();B34<TODAY();B36=4);4;IF(O R(B31>TODAY();B32>TODAY();B33>TODAY();B34>TODAY(); AND(B31<TODAY();B32<TODAY();B33<TODAY();B34<TODAY( );B36 = 1));1;"error")))

    Thanks in advance

  2. #2
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    Hi,

    In VBA pseudocode, the formula translates to:
    Code:
    If (B31:B34 are all less than today) And ( either (B36 is empty) Or (B36 = 2) ) Then
        Function Value = 2
     
    ElseIf (B31:B34 are all less than today) And (B36 = 4) Then
       Function Value = 4
     
    ElseIf (Any of B31:B34 are greater than today) Or ( (B31:B34 are all less than today) And (B36 = 1) ) Then
        Function Value = 1
     
    Else
       Function Value = "Error"
     
    End If
    Only you can tell whether or not the logic of that formula is correct!

    Hope that helps..
    Last edited by Colin Legg; 03-22-10 at 13:41.

  3. #3
    Join Date
    Sep 2003
    Posts
    5
    Thanks Colin,
    this was all I needed.

    Eddy

Posting Permissions

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