Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Pro Football formula automation

I posted a similar question on another board, haven't had luck yet.
Will try to explain it better here.
In column B, I have opponents for teams in column A. I have empty
cells between each team in column A also.
Ex: A2:A17 is Arizona, B2:B17 is San Fransisco, Seattle, Baltimore,
etc. (Opponents of Arizona)

Then I skip 2 lines and list Atlanta in A20:A37 and list their
opponents in B20:B37, and I do this for all 32 teams. The last entry
ends on row 638. I have Named Ranges for each team, but the names
differ from the team names.

Arizona's Named Range is "Ari_Avg", Atlanta's is "Atl_Avg", San
Fransisco's is SF_Avg etc.

What I need to do (in VBA I suppose), is write a formula in column G
that looks in column B, and if B2 text is San Fransisco, then write
the formula "=AVERAGE(SF_Avg)"

I have searched Help and Newsgroups for an answer, and have tried
different methods, but can't get my code to work. I tried using 32
if's (one for each team) but keep getting errors, like If without
block If. Would it be easier to name my Named Ranges to equal the text
in B2:B638, then use Offset, like another guy tried to help me with?
Shoot, I couldn't even make that work.

I think I need something like:
If c.Value(B2:B638) = San Fransisco Then (G2:G638).Formula =
"AVERAGE(SF_Avg)"

Hope someone can help. Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Pro Football formula automation

Hi Tim -

If you'd be willing to rename your ranges, a very simple formula will work
without any fussing with VBA. The formula as entered in G1 would be:

=Average(Indirect(B1))

To make this work, you'll have to rename all of your XXX_Avg ranges to the
team's city and use that name (exactly) in the opponents column. For
example, rename the SF_Avg range to "SanFrancisco" and use that exact name in
the opponents column.

If you stick with your original approach, we have two choices, both of which
seem to be more work than the approach described above:

1. Build a cross-reference table somewhere in your workbook that
cross-references the value in the oppenents column with the XXX_Avg range
name. Then, add the VLookup function to the formula in column G:

=Average(Indirect(Vlookup(B1,CrossReferenceTable,2 ,False)))

2. Build a VBA procedure.

---
Jay


"Tim" wrote:

I posted a similar question on another board, haven't had luck yet.
Will try to explain it better here.
In column B, I have opponents for teams in column A. I have empty
cells between each team in column A also.
Ex: A2:A17 is Arizona, B2:B17 is San Fransisco, Seattle, Baltimore,
etc. (Opponents of Arizona)

Then I skip 2 lines and list Atlanta in A20:A37 and list their
opponents in B20:B37, and I do this for all 32 teams. The last entry
ends on row 638. I have Named Ranges for each team, but the names
differ from the team names.

Arizona's Named Range is "Ari_Avg", Atlanta's is "Atl_Avg", San
Fransisco's is SF_Avg etc.

What I need to do (in VBA I suppose), is write a formula in column G
that looks in column B, and if B2 text is San Fransisco, then write
the formula "=AVERAGE(SF_Avg)"

I have searched Help and Newsgroups for an answer, and have tried
different methods, but can't get my code to work. I tried using 32
if's (one for each team) but keep getting errors, like If without
block If. Would it be easier to name my Named Ranges to equal the text
in B2:B638, then use Offset, like another guy tried to help me with?
Shoot, I couldn't even make that work.

I think I need something like:
If c.Value(B2:B638) = San Fransisco Then (G2:G638).Formula =
"AVERAGE(SF_Avg)"

Hope someone can help. Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Pro Football formula automation

Thanks Jay. I was going to try something like that earlier, but my
Teams often were two words, and I couldn't name a range like that. I
believe I'll make them one word and try that. Thank you.

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
Formula for evaluating predictions - Fantasy Football League gavin Excel Discussion (Misc queries) 9 July 4th 10 02:41 AM
Formula for Football (Soccer) Prediction League genius7082 Excel Discussion (Misc queries) 1 August 10th 08 09:39 PM
Supressing the ctrl-c and other keys during word automation in automation apondu Excel Programming 0 July 19th 07 10:10 PM
Fantasy Football Datbase or Formula Dave Excel Discussion (Misc queries) 0 July 8th 05 09:18 PM
Football Predictions Spreadsheet formula problem Glenn Richardson Excel Programming 2 September 25th 04 10:47 PM


All times are GMT +1. The time now is 03:26 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"