+ Reply to Thread
Results 1 to 3 of 3

macro help

  1. #1
    Registered User
    Join Date
    02-10-2006
    Posts
    9

    macro help

    hey guys'
    need help writing this formula as a macro, i need to nest an infinite number of
    packs
    =IF(B1="2pack",H1/4,IF(B1="3 packl",H1/15,IF(B1="4 pack",H1/15,"not")))

    thanks
    jason

  2. #2
    Kassie
    Guest

    RE: macro help

    Hi

    Why don't you create a table with all your packs and division factors, and
    then use Vlookup to retrieve same?

    "jwfakouri" wrote:

    >
    > hey guys'
    > need help writing this formula as a macro, i need to nest an
    > infinite number of
    > packs
    > =IF(B1="2pack",H1/4,IF(B1="3
    > packl",H1/15,IF(B1="4 pack",H1/15,"not")))
    >
    > thanks
    > jason
    >
    >
    > --
    > jwfakouri
    > ------------------------------------------------------------------------
    > jwfakouri's Profile: http://www.excelforum.com/member.php...o&userid=31435
    > View this thread: http://www.excelforum.com/showthread...hreadid=514024
    >
    >


  3. #3
    Jim Cone
    Guest

    Re: macro help

    jason,
    Maybe something like this...

    '----------------------------------
    Function WhackAMole() As Double
    Dim strName As String
    Dim dblValue As Double
    Dim dblAnswer As Double
    strName = Range("B1").Text
    dblValue = Range("H1").Value2

    Select Case strName
    Case "2pack"
    dblAnswer = dblValue / 4
    Case "3pack"
    dblAnswer = dblValue / 15
    Case "4pack"
    dblAnswer = dblValue / 15
    'enter as many more as you need...
    Case Else
    dblAnswer = 0
    End Select

    WhackAMole = dblAnswer
    End Function
    '------------------------------------
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware



    "jwfakouri" wrote in message
    hey guys'
    need help writing this formula as a macro, i need to nest an
    infinite number of
    packs
    =IF(B1="2pack",H1/4,IF(B1="3
    packl",H1/15,IF(B1="4 pack",H1/15,"not")))

    thanks
    jason
    jwfakouri


+ 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