Consulting

Results 1 to 7 of 7

Thread: AR Aging - will not skip blank cells

  1. #1

    AR Aging - will not skip blank cells

    I have an aging report that will calaulate the ages of an invoice and than put in a corresponding column. The only problem is that it is taking all blanks and returning "#VALUE!" in cells with text and is returning "40257" on blank cells. I only want it to age if there is a real DATE in column "A".

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Try this in D16 you can drag it down.

    [VBA]=IF(ISNONTEXT(A16),(TODAY()-A16),"")[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Whoops, I missed the second if statement for the numbers. Try this in A16 and drag it down.

    [VBA]=IF(A16<>"",IF(ISNONTEXT(A16),(TODAY()-A16),""),"")[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  4. #4
    I tried that but still got an error on the blank cells. I changed it to =IF(ISNUMBER(A16),(TODAY()-A16),"") and that worked. Right now i have the formula value in a macro. Do you know how i could fix that?
    Last edited by cabotiger; 03-20-2010 at 03:50 PM.

  5. #5
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    =IF(AND(ISNUMBER(A16),A16>0),TODAY()-A16,"")
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    This is the macro that i was using before- Is it possible to change this?


    [VBA]Sub daysBetweenDates()
    Dim myDest As Range
    Range("D1626").FormulaR1C1 = "=(TODAY()-RC[-3])"
    Select Case Range("C16").Value
    Case 0 To 30: Set myDest = Range("E16:E26")
    Case 31 To 60: Set myDest = Range("F16:F26")
    Case 61 To 90: Set myDest = Range("G16:G26")
    Case 91 To 120: Set myDest = Range("H16:H26")
    Case Is > 120: Set myDest = Range("I16:I26")
    End Select
    Range("C16:C26").Copy myDest
    End Sub[/VBA]
    Last edited by cabotiger; 03-20-2010 at 03:57 PM.

  7. #7
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You could also use a User Defined Function (UDF) and enter =AGE(A16)
    [vba]

    Function Age(Dte As Range)
    If IsDate(Dte) Then
    Age = Date - Dte
    Else: Age = ""
    End If
    End Function

    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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