Forum Discussion
JoseFromParis
Mar 20, 2023Copper Contributor
Looking for formula maybe or type of display.
Hello,
I am creating an excel file to follow up my team with their training and roles in my team. I have 150 person in their.
I wish to have something like:
Bob
- [action] web designer
- [role] ceo
Julie
- [action] web designer
- [role] ceo
But i told you, because i have 150 person, i wish to see just their names and after when i click on it lines below appears.
Before:
Bob
Julie
After clicking on one name:
Bob
Julie
- [action] web designer
- [role] ceo
How can i do?
4 Replies
Sort By
- SnowMan55Bronze Contributor
Jan and Matt seem to think that each team member has only one action and only one role. I didn't assume so. If your spreadsheet contains rows that each contain the team member name and either one action or one role (does not need to be sorted, so long as all rows for a team member are adjacent), like this:
or if you can readily come up with that structure in another spreadsheet, then yes, it's easy to use the "outline" features of Excel to do that. It's not difficult, and does not require a macro (or other VBA code).Info on outlining is available in this Microsoft article: Outline (group) data in a worksheet
In the attached workbook, I have several worksheets, to step you through the process. See Sheet1. I started with column headings of Employee and Info, but those names are not important; you can change them initially or later.
Add a column just to the right (column C in my case), and populate all its cells for your data rows with a value of 1. See Sheet2. I gave this column a heading of Items, but again, the name is unimportant.
Select all of the headings and data (rows and columns). Under the Data menu, in the Outline group, click Subtotal. In the Subtotal dialog, select a "Use function" of Count. Uncheck the checkbox that reads "Summary below data".
Click OK.Without changing the selection, click the tiny arrow in the lower right of the Outline group:
to get the Settings dialog.
Ensure that the checkboxes are checked as shown. Click OK. See Sheet3.So at this point, your worksheet should have the expand/collapse buttons at the left on the appropriate rows. You can now hide the Items column. To visually clean up the column that identifies the team members, insert a column in front of column A, and put in this formula for all rows through the bottom of your data (shown here for row 2):
=IF(B2="Grand Count", "", IF(RIGHT(B2,6)=" Count",LEFT(B2,LEN(B2)-6), ""))
Give that new column A whatever heading you want, and hide column B. See Sheet4.
How does that work for you?
- GVeeranalaCopper Contributor
you can use VBA to get the value of the clicked cell and use it in VLookup to show the needed information.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) ActiveCell.copy Range("e2").PasteSpecial xlPasteValues End Sub
here e2 is the cell address, where the clicked name is copied, then it will be used for VLookup
for using VLookup, create data in another sheet and name the range
check the demo
https://www.awesomescreenshot.com/video/15770910?key=1a76e8dee88188244f1c333e1a2fd353
- JKPieterseSilver ContributorWhy not a simple table with these columns:
Name, Action, Role
then you can simply put the information belonging to Bob in the Action and in the Role column.- mtarlerSilver Contributor
JoseFromParis There is a feature to "Group" lines and then you can expand or collapse those lines. In the following image is Bob with his lines collapsed and Julie with her lines expanded. The +/- buttons on the left will expand and collapse the lines accordingly:
But the effort to apply that formatting seems like a lot but a macro could be created to do it. That said, I agree with Jan that an easier method would be to convert the data to be a table:
Name Action Role Bob Web Designer ceo Julie Web Designer ceo