Solved

Display Excel details based on user input

Posted on 2014-03-31
3
167 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

828 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