[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Excel source data lookup based on variable

Posted on 2012-03-15
4
Medium Priority
?
204 Views
Last Modified: 2012-03-15
I hope somebody can help with this question.

I am trying to create a set of financial reports for a customer based upon data imported into Excel using an ODBC data query.  The data is imported into a worksheet called 'Source Data' and contains 12 columns, one for each financial period 1 through to 12.

The reporting worksheet, 'Report', uses a link, =ABS('Source Data'!$R$4) for period 1, =ABS('Source Data'!$S$4) for period 2, etc.  'Report' has a variable called 'Period' which will accept a user entered value between 1 and 12, corresponding to the financial period.

Is there a way of updating the link source to update the column $R, $S, etc. based upon the value of 'Period', rather than using a set of nested IF statements?  So if 'Period' = 1 then the link would be "=ABS('Source Data'!$R$4)", if 'Period' = 2 then the link would be "=ABS('Source Data'!$S$4)", and so on.  As the report has around 50 rows it would save a lot of typing and potential errors.
0
Comment
Question by:Steve Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37727194
"=ABS('Source Data'!" & Cells(4, 17 + period).Address & ")"
0
 
LVL 42

Assisted Solution

by:dlmille
dlmille earned 600 total points
ID: 37727232
@ssaqibh - would INDIRECT be required here?

@AztechMicros - are you looking for macro code or a smart formula?

Dave
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 1400 total points
ID: 37727262
Hi, Dave, I went by

has a variable called 'Period' which

thinking that it was for VBA but maybe variable means range name

So in that case it should be

=ABS(INDIRECT(ADDRESS(4,17+period,,,"Source Data")))
0
 

Author Closing Comment

by:Steve Brown
ID: 37728067
Absolutely bloody marvellous!!  Thanks guys.  Worked straight away with that solution, makes my reports a WHOLE lot easier.

I hope I have split the points fairly, and yes it was a smart formula I was using.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question