LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Function Trouble: Not sure how to correctly reference my variable

I am trying to calculate the variance between the average number of
guests per week and the actual guests who have visited. I have 5
tiers of guest counts and they are all listed in the piece of code I
submitted.

The code seems to work, but when I spot check a few of the
calculations they don’t add up. Specifically, I believe the formula
stops working at Tier2. For some reason, (probably obvious to one of
the more experienced users) anything greater than 4000 is calculated
against the Tier2 reference. Any suggestions? Please don’t be shy, I
understand this group is brutally honest. If this doesn’t make since,
let me know and I will clarify. This is irritating.

Function AWGCVAR(Avg_Guests_Wk)
' Calulates the variance in AWGC as determined by the appropiate
tier. YTD
Dim Tier1 As Double, Tier2 As Double
Dim Tier3 As Double, tier4 As Double
Dim tier5 As Double
Tier1 = Range("F$743")
Tier2 = Range("F$744")
Tier3 = Range("F$745")
tier4 = Range("F$746")
tier5 = Range("F$747")
Select Case Avg_Guests_Wk
Case Is < 3000: AWGCVAR = -Tier1 + Avg_Guests_Wk
Case Is 3000 <= 4000: AWGCVAR = -Tier2 + Avg_Guests_Wk
Case Is 4000 <= 5000: AWGCVAR = -Tier3 + Avg_Guests_Wk
Case Is 5000 <= 6000: AWGCVAR = -tier4 + Avg_Guests_Wk
Case Is 6000: AWGCVAR = -tier5 + Avg_Guests_Wk
End Select
End Function
 
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
Variable reference in a function Wildebraam Production Excel Worksheet Functions 3 April 25th 09 03:50 PM
cant seem to get a function to reference a variable cell? Archie Excel Programming 1 June 22nd 07 05:51 PM
I am having trouble with excel not ascending correctly Rob rock New Users to Excel 4 November 22nd 05 04:48 AM
A function to get a variable row reference for range in XNPV funct Tex1960 Excel Worksheet Functions 6 August 1st 05 11:20 PM
MIN Function w/ variable address reference WLMPilot Excel Worksheet Functions 7 June 10th 05 07:56 PM


All times are GMT +1. The time now is 12:32 PM.

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

About Us

"It's about Microsoft Excel"