+ Reply to Thread
Results 1 to 2 of 2

Formula with arrays

  1. #1
    Registered User
    Join Date
    03-06-2006
    Posts
    1

    Formula with arrays

    I would like to make a formula that in the same range, consider only the cells where the color font is red and acumulate those values. I I wrote this formula below, but it is not working: PLEASE HELP!!

    Function BestPrice(MySelection1 As Range, MySelection2 As Range) As Variant
    Dim v1, v2, T As Variant
    v2 = MySelection2.Font.ColorIndex
    v1 = MySelection1.Value
    T = 0
    For i = 1 To UBound(v1, 1)
    If v2(i, 1) = 3 Then
    T = T + v1(i, 1)
    Else
    T = T
    End If
    Next
    BestPrice = T
    End Function

  2. #2
    Norman Jones
    Guest

    Re: Formula with arrays

    Hi E,

    See xlDynamic's Colour functions page at:

    http://www.xldynamic.com/source/xld.....html#counting


    ---
    Regards,
    Norman



    "eamendes" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I would like to make a formula that in the same range, consider only the
    > cells where the color font is red and acumulate those values. I I wrote
    > this formula below, but it is not working: *PLEASE HELP!!*
    >
    > Function BestPrice(MySelection1 As Range, MySelection2 As Range) As
    > Variant
    > Dim v1, v2, T As Variant
    > v2 = MySelection2.Font.ColorIndex
    > v1 = MySelection1.Value
    > T = 0
    > For i = 1 To UBound(v1, 1)
    > If v2(i, 1) = 3 Then
    > T = T + v1(i, 1)
    > Else
    > T = T
    > End If
    > Next
    > BestPrice = T
    > End Function
    >
    >
    > --
    > eamendes
    > ------------------------------------------------------------------------
    > eamendes's Profile:
    > http://www.excelforum.com/member.php...o&userid=32176
    > View this thread: http://www.excelforum.com/showthread...hreadid=519239
    >




+ Reply to Thread

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