PC Review


Reply
Thread Tools Rate Thread

CHOOSE and External References

 
 
ScottS
Guest
Posts: n/a
 
      29th May 2008
Hello all,

My client makes extensive use of long CHOOSE formulas that references cells
in another large workbook. They are constantly using these CHOOSE formulas
for buliding "reports" in dozens of workbooks. I am concerned that any
changes to the structure of the large source workbook would require a
mega-editing effort.

e.g.: CHOOSE($B$1,'[Data File.xls]Actual'!F23,'[Data
File.xls]Actual'!G23,'[Data File.xls]Actual'!H23,'[Data
File.xls]Actual'!I23,'[Data File.xls]Actual'!J23,'[Data
File.xls]Actual'!K23,'[Data File.xls]Actual'!L23,'[Data
File.xls]Actual'!M23,'[Data File.xls]Actual'!N23,'[Data
File.xls]Actual'!O23,'[Data File.xls]Actual'!P23,'[Data File.xls]Actual'!Q23)

I am recommending setting up the CHOOSE functionality using VBA functions
they can use where ever they need. This way a structural change could be
taken care of in one place.

Would it be best to use the CHOOSE in my function or is there a better way?
Is there a special syntax for referencing another workbook from within a VBA
function?
(I'm coming from Access here and am just getting up to speed on VBA in Excel).

Thanks!

Scott






--
Scott S
 
Reply With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      29th May 2008
Scott,

Their formula

=CHOOSE($B$1,'[Data File.xls]Actual'!F23,'[Data
File.xls]Actual'!G23,'[Data File.xls]Actual'!H23,'[Data
File.xls]Actual'!I23,'[Data File.xls]Actual'!J23,'[Data
File.xls]Actual'!K23,'[Data File.xls]Actual'!L23,'[Data
File.xls]Actual'!M23,'[Data File.xls]Actual'!N23,'[Data
File.xls]Actual'!O23,'[Data File.xls]Actual'!P23,'[Data File.xls]Actual'!Q23)

would better be

=INDEX('[Data File.xls]Actual'!$F$23:$Q$23,1,$B$1)

But note that the range to select (the F23:Q23) could also be made dynamic. Suppose you had a table
on the Actual sheet with column headings in row 1 and row labels in column A. Then you could use a
formula like

=INDEX('[Data File.xls]Actual'!$1:$65536,MATCH("Label for Row 23",'[Data
File.xls]Actual'!$A:$A,FALSE),MATCH("Col Heading",'[Data File.xls]Actual'!$1:$1,FALSE))

This would extract specific data by labels rather than being tied to an exact row or column,
allowing for the insertion and deletion of rows and columns of data (as long as column A and Row 1
stayed put). The "Label for Row 23" and "Col Heading" could also be cell references.

That would make it much more robust.

HTH,
Bernie
MS Excel MVP


"ScottS" <(E-Mail Removed)> wrote in message
news:A2A1CF5D-1E49-47D0-9EF0-(E-Mail Removed)...
> Hello all,
>
> My client makes extensive use of long CHOOSE formulas that references cells
> in another large workbook. They are constantly using these CHOOSE formulas
> for buliding "reports" in dozens of workbooks. I am concerned that any
> changes to the structure of the large source workbook would require a
> mega-editing effort.
>
> e.g.: CHOOSE($B$1,'[Data File.xls]Actual'!F23,'[Data
> File.xls]Actual'!G23,'[Data File.xls]Actual'!H23,'[Data
> File.xls]Actual'!I23,'[Data File.xls]Actual'!J23,'[Data
> File.xls]Actual'!K23,'[Data File.xls]Actual'!L23,'[Data
> File.xls]Actual'!M23,'[Data File.xls]Actual'!N23,'[Data
> File.xls]Actual'!O23,'[Data File.xls]Actual'!P23,'[Data File.xls]Actual'!Q23)
>
> I am recommending setting up the CHOOSE functionality using VBA functions
> they can use where ever they need. This way a structural change could be
> taken care of in one place.
>
> Would it be best to use the CHOOSE in my function or is there a better way?
> Is there a special syntax for referencing another workbook from within a VBA
> function?
> (I'm coming from Access here and am just getting up to speed on VBA in Excel).
>
> Thanks!
>
> Scott
>
>
>
>
>
>
> --
> Scott S



 
Reply With Quote
 
ScottS
Guest
Posts: n/a
 
      29th May 2008
Thanks much Bernie - this helps a lot.
--
Scott S


"Bernie Deitrick" wrote:

> Scott,
>
> Their formula
>
> =CHOOSE($B$1,'[Data File.xls]Actual'!F23,'[Data
> File.xls]Actual'!G23,'[Data File.xls]Actual'!H23,'[Data
> File.xls]Actual'!I23,'[Data File.xls]Actual'!J23,'[Data
> File.xls]Actual'!K23,'[Data File.xls]Actual'!L23,'[Data
> File.xls]Actual'!M23,'[Data File.xls]Actual'!N23,'[Data
> File.xls]Actual'!O23,'[Data File.xls]Actual'!P23,'[Data File.xls]Actual'!Q23)
>
> would better be
>
> =INDEX('[Data File.xls]Actual'!$F$23:$Q$23,1,$B$1)
>
> But note that the range to select (the F23:Q23) could also be made dynamic. Suppose you had a table
> on the Actual sheet with column headings in row 1 and row labels in column A. Then you could use a
> formula like
>
> =INDEX('[Data File.xls]Actual'!$1:$65536,MATCH("Label for Row 23",'[Data
> File.xls]Actual'!$A:$A,FALSE),MATCH("Col Heading",'[Data File.xls]Actual'!$1:$1,FALSE))
>
> This would extract specific data by labels rather than being tied to an exact row or column,
> allowing for the insertion and deletion of rows and columns of data (as long as column A and Row 1
> stayed put). The "Label for Row 23" and "Col Heading" could also be cell references.
>
> That would make it much more robust.
>
> HTH,
> Bernie
> MS Excel MVP
>
>
> "ScottS" <(E-Mail Removed)> wrote in message
> news:A2A1CF5D-1E49-47D0-9EF0-(E-Mail Removed)...
> > Hello all,
> >
> > My client makes extensive use of long CHOOSE formulas that references cells
> > in another large workbook. They are constantly using these CHOOSE formulas
> > for buliding "reports" in dozens of workbooks. I am concerned that any
> > changes to the structure of the large source workbook would require a
> > mega-editing effort.
> >
> > e.g.: CHOOSE($B$1,'[Data File.xls]Actual'!F23,'[Data
> > File.xls]Actual'!G23,'[Data File.xls]Actual'!H23,'[Data
> > File.xls]Actual'!I23,'[Data File.xls]Actual'!J23,'[Data
> > File.xls]Actual'!K23,'[Data File.xls]Actual'!L23,'[Data
> > File.xls]Actual'!M23,'[Data File.xls]Actual'!N23,'[Data
> > File.xls]Actual'!O23,'[Data File.xls]Actual'!P23,'[Data File.xls]Actual'!Q23)
> >
> > I am recommending setting up the CHOOSE functionality using VBA functions
> > they can use where ever they need. This way a structural change could be
> > taken care of in one place.
> >
> > Would it be best to use the CHOOSE in my function or is there a better way?
> > Is there a special syntax for referencing another workbook from within a VBA
> > function?
> > (I'm coming from Access here and am just getting up to speed on VBA in Excel).
> >
> > Thanks!
> >
> > Scott
> >
> >
> >
> >
> >
> >
> > --
> > Scott S

>
>
>

 
Reply With Quote
 
 
 
Reply

« Events | Macro »
Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
External References vs. Get External Data Keith Microsoft Excel Discussion 0 26th Jan 2011 07:22 PM
Named formulas in CHOOSE need to be Relative references when paste =?Utf-8?B?YmlsbCBjaA==?= Microsoft Excel Worksheet Functions 2 10th Apr 2006 04:13 PM
Modify Paste Special to choose absolute or relative references =?Utf-8?B?cGV0ZXJs?= Microsoft Excel Programming 1 30th Dec 2005 12:04 AM
External references Dean Microsoft Excel Programming 2 4th Mar 2005 04:59 AM
External References Pinda Microsoft Excel Worksheet Functions 1 12th Nov 2003 03:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:23 AM.