Results 1 to 5 of 5

Array formula

Threaded View

  1. #4
    Registered User
    Join Date
    12-27-2009
    Location
    Paris, France
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: Array formula

    Hello,

    A lead with a personal function.

    Copy this code in a standard module

    Function ArrayFormula(Cell1 As Range, Cell2 As Range) As String
    Dim i&
    Dim j&
    Dim k&
    Dim A$
    Dim Animals
    Application.Volatile
    If Cell2 < 1 Or Cell2 > 7 Then
      ArrayFormula = vbNullChar
      Exit Function
    End If
    Animals = Array("Cats", "Dogs", "Birds")
    For j& = LBound(Animals) To UBound(Animals)
      If Cell1 = Animals(j&) Then
        A$ = Cell1
        k& = 0
        For i& = (j& + 1) * 2 - 1 To (j& + 1) * 2
          k& = k& + 1
          If Cell2 = i& Then
            ArrayFormula = A$ & " " & k&
            Exit Function
          End If
        Next i&
      End If
    Next j&
    If A$ = vbNullString Then
      ArrayFormula = "Fish"
    Else
      ArrayFormula = A$
    End If
    End Function

    ArrayFormula(Cell1 As Range, Cell2 As Range)
    Cell1 as range of animal's name
    Cell2 as range of number

    Example :
    in A1 Cats, in B1 2 , in C1 =ArrayFormula(A1;B1) => Cats 2

    With regards.

    PMO
    Patrick Morange
    Attached Files Attached Files

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