#1   Report Post  
Posted to microsoft.public.excel.misc
jwfakouri
 
Posts: n/a
Default 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


--
jwfakouri
------------------------------------------------------------------------
jwfakouri's Profile: http://www.excelforum.com/member.php...o&userid=31435
View this thread: http://www.excelforum.com/showthread...hreadid=514024

  #2   Report Post  
Posted to microsoft.public.excel.misc
Kassie
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Jim Cone
 
Posts: n/a
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM


All times are GMT +1. The time now is 12:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"