Solved

Display Excel details based on user input

Posted on 2014-03-31
3
166 Views
Last Modified: 2014-04-01
Hi,

This is a simplified version of a post I made a couple of hours ago.
If this is contrary to etiquette then please advise!

It is best explained by looking at the attached.

When the user enters one of the 3 yellow cells (i.e. chooses a country) then ... this countries details should be displayed in full in the green section.  Note that the source of all the end data is the table on the far left.

So, entering one of the yellow cell generates a "drill down" in the green area.
How can I achieve this?
EEMan2.xlsx
0
Comment
Question by:Patrick O'Dea
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 500 total points
ID: 39968348
Please refer to the attached. This was accomplished as follows:

First, a new column A was added and has this formula:

=COUNTIF($C$2:C2,C2)&C2

It's copied down and the result is the Country with a sequential number in front of it. I.E 1UK, 2UK.

Column L uses this formula:

=IFERROR(VLOOKUP(1&Ctry,A:D,2,FALSE),"")

This formula returns the city number ( the "2" returns the second column in range A:D). If there is no city associated with the selection, the IFERROR returns a blank cell. Column M uses the same formula with the "2" changed to "4".

If you right-click the tab and select View Code, you'll see this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

  ActiveWorkbook.Names.Add Name:="Ctry", RefersToR1C1:=ActiveCell
  Me.Calculate

End Sub

This assigns the value of the active cell to Ctry, which is used in the VLOOKUP formula.

To conform with the requirement "User will only be allowed into yellow cells", the sheet is protected.
EEMan2.xlsm
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 39968540
Flyster,

Thanks for a superb answer.
In particular, it is great because it is so relatively clean and simple.

(I need to convert this logic into my real world scenario but that's a different project!)

Thanks again!
0
 
LVL 22

Expert Comment

by:Flyster
ID: 39969825
Thank you. Glad I could help!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
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 the scrolling table in Microsoft Excel using the INDEX function.

776 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