ungrouping Excel data saved as an Outline as a pivot table - excel

I do not know if it is possible to do what I want to achieve in Excel, but I have the data that is generated in the Outline (let's assume: on the left side of the screen I have a "plus", if I press it, I have another "+" and I get to the next detailed data.
The problem is, when I ungroup it all, I have every item in column "A" and I can't make it into a PivotTable.
What I mean?
Example (you can see it in the photo).
1 "plus" - country:
[![enter image description here][1]][1]2 "plus" - city:
3 "plus" - brand of items sold
4 "plus" - exact equipment from this brand
When I ungroup it, everything is in one column and it should be - respectively - 1 "plus" - column A, 2 "plus" - column B, etc.
Is there any possibility to ungroup it according to the "pluses".
I hope there is any sollution...
Thanks

See https://www.mrexcel.com/board/threads/calculating-outline-levels-in-excel.227279/#post-1112028 copied here:
Select cell A1 of the sheet,
Do menu command Insert/Name/Define, and create a name called DetailLevel, with a formula ( in the Refers To box ) of:
=GET.CELL(28,Sheet1!A1)
( alter the sheet name Sheet1 to whatever your sheet is called )
Now in any blank column of the sheet type the formula =DetailLevel and copy down.
That will give you 1 for no indent, 2 for level 2, 3 for level 3
bring that along as data column to create pivot table

Related

How to create dropdown from existing data?

One of my worksheets (Sites) contains a list of sites.
Column B contains the sites unique ID, Column C contains the site type.
This is an example, the real data will have many more entries.
Eg:
Column B Column C
1234-56789 NW175
5468-58754 SW124
8787-97979 PO962
9247-75204 NW116
1458-56155 NW120
7486-89251 KA960
975-983044 PO630
I'd like to be able to present a dropdown list in cell A5 on worksheet 1 (Home) containing only entries starting with NW.
I'd like the list to appear as:
NW175 - 1234-56789
NW116 - 9247-75204
NW120 - 1458-56155
Is there any way to do this without using macros?
If you are using Excel 365 then you can use the new FILTER-Function.
Also I would propose that you use a table to define your site-configuration.
There you add a new column, e.g. Full name and apply the formula to concatenate both values.
Then the new FILTER-function comes into play - see my screenshot - you have to use the formula =FILTER(tblSiteInfo[Full name];LEFT(tblSiteInfo[Site Type];2) = "NW") --> the filtered result spills down as a new list
Next step: define a name for the cell (and only the cell with the formula) and apply a # at the end of the name-address.
You can then use this name for your validation list.
Benefit of this solution: if you add more sites to the configuration table the validation list will update automatically.
To concat strings with cell variables use & operator. According to your example paste this =C2&" - "&B2 to column D for example D2 and pull down to apply rest of rows below.
For creating a dropdown menu from concatenated data follow these steps.
1 - Select the cell where you want to create dropdown list
2 - Go to Data tab
3 - Click to Data Validation
4 - Select List from Allow dropdown
5 - Click Source and mark column D for example =$D$2:$D$8
6 - Click Ok

EXCEL How to concat values from multiple rows in a single row on another worksheet?

I have two columns:
ID country
1 spain
1 france
1 sweeden
2 mexico
how to concat all the countries with ID 1 and send them to another column like this
ID2 country2
1 spainfrancesweeden
How to do this with an excel formula instead of a VBA code.
I tried this:
=CONCATENATE(VLOOKUP(A18; Hoja2!A19:Hoja2!B24; 2; 1); " ";VLOOKUP(A18; Hoja2!A19:Hoja2!B24; 2; 0))
But it only gets two results (but there are 3)
Layout of sheet:
Do convert your data to table and insert pivot table, on the screen of create pivot table check the option add this data to the data model, now go to pivot table fields and right click on the table name and click on add measure. There would be a window opened in the name of Measure in which you put the measure name and value description as per your choice. Now come to formula area which would start with = sign there you type below formula concatenatex(table1,table1[country],","). Now one additional function would had created in the area of pivot table fields. Now you can drag id into rows and drag the created function into Values. It would show the desired result as follows.,
Row Lables|Joincountry
1 |Spain,France,Sweedan
2 |Mexico
Hope this is order and would help you.
!
[result]1

How can I make a drop down list that stores an index value in a hidden field?

I have an Excel spreadsheet where on Sheet 1 the Department Id is represented as a number and where on Sheet 2 there is a list of those numbers with the Department Name next to them.
If possible I would like some help and advice as I want to allow the user to select the Department Name from a drop down list and have it populate a hidden field with the department number.
Something like in Sheet 3 with the Department Id being stored for example in the C column on that page:
Sheet 1
Sheet 2
Sheet 3
This could be one approach.
If I have understood you correctly, the user will select the department name in a drop-down list in Sheet 3 and and the index number associated with that department name will appear. The user will not be limited to what name (andy, bob) it is in the adjacent column...
Result will be (notice this is a Excel Table!) :
We have the 3 sheets:
Select the data areas and click on "Format as Table", Select the option "My data has headers". Do this for all the 3 sheets.
Name your tables: "Design" -> "Table Name". I will use "Table1" for "Sheet1", "Table2" for "Sheet2" etc. It will make life easier when you link and refer in formulas. Notice that for "Sheet3" I also add a dummy column C. I name it "Index Number".
Go to "Sheet2" and select the range that you want to use as your drop-down list (in my case i choose Department Names and selected "B2:B8". Click "Formulas" -> "Name Manager" -> "New..."
This window will pop-up. Name it an easy name (I named it: "Department_Names") and check that the "Refers to:" is in this format "=TableX[Column Name]". In our case =Table2[Department]. Notice that the name manager don't use "B2:B8", rather is reference to the table column area. The last step is very important!
Go to Sheet3. Click on cell where you want to apply the drop-down list (I use B2 in the example). Click "Data" -> "Data Validation".
Data Validation window will now pop-up. Go to "List" and in the field "Source:" you write your named range as =Department_Names (the one I named "Department_Names"). The drop-down list will use the values in the range that "Department_Names" are applied to. In our case it will make a drop-down list of all the department names from "Sheet2", range B2:B8.
Go to "Sheet3" and enter the formula below in the cell C2 as shown in the picture.
Notice I use " ; "as delimiter (European version of Excel, US user will probably use" , ").
=IF([#Department]="","",IFERROR(INDEX(Table2[ID],MATCH([#Department],Table2[Department],0)),))
The first part creates our Index number:
...IFERROR(INDEX(Table2[ID],MATCH([#Department],Table2[Department],0)),)
Return the Index number from "Table2", Column ID. INDEX(Table2[ID]
lookup value in the MATCH formula comes from "Table3", Department
(drop-down list)
The lookup value will look in "Table2", column Department.
Will take care of 0 that will be created when nothing is selected in the "Table3", Department column (see next picture for example)
=IF([#Department]="","", ...formula...)
Formula without the =IF([#Department]="","", ...formula...)
You can hide the "Index Number" column in "Sheet3" if you don't want to have it visible.
Right click on the Column C header and choose "Hide".
Only for demonstration purpose here. I create a dummy column "Only for show hidden column values". So when the user selects a Department name, it will change the index number associated to that department.
So why the use of tables and named range?
Let's say you need to add a new department. We add a department in the "Table2" and we give it ID: 7 and Department Name: Department H.
What happens in your "Sheet3" is that the drop-down list will automatically catch the new row. The range named to "Department_Names" will adjust to the table rows because it's linked to "Table2[Department]". This is also true if you decrease rows for Table2. Source
I have not tested it, but I'm quite sure that you can link a table to an external source. So when you import your data to the table (given the headers is static) the table will be updated with "Refresh All" button in Excel. Something to explore and look further into :)
It can be done with INDEX/MATCH.
As an example:
Sheet1 contains your lookup table.
For simplicity sake Sheet1 has numbers 1 - 6 in the range A1:A6 and A - F in the range B1:B6.
1 - 6 are the primary keys and A - F are the descriptions.
Sheet2 has Data Validation in column A: Allow List using =Sheet1!$B$1:$B$6 as the Source. This will give you the drop-down in column A.
In column B, which is hidden, you have the formula =IFERROR(INDEX(Sheet1!$A:$A,MATCH($A2,Sheet1!$B:$B,0)),"")
The MATCH formula will return the row number in Sheet1 that the description appears in.
The INDEX formula will return a reference to the cell in column A on that same row - giving the Primary Key value.
If no match is found then #N/A is returned which is dealt with by the IFERROR statement.
This method will work if your departments are less than equal to 32.
In UTF 8 characters from code 128 to 160 are hidden (among many others). You can use these characters as your id key, you have to just concatenate them with your department name.
This is a screenshot of excel
3rd column is the Unicode character, 4th is concatenation of this character and the department name and last column is extracted id from the new department name.
These are the formulas
At the end it can also work if your departments are more than 32 but you have to find another slot of non-printable characters
You have to use the new department names as data validation drop downs where department entry is required and can extract the id from the entered department

passing parameter to build a dynamic string in excel

My requirement is very simple but i am not finding it easy-
In excel, column A is having 'Table name' and column B is having 'Column name'
I want to write a query-
Select * from 'column A' where 'column B' is not null.
In excel I have 2578 lines so I dont want to write 2578 Select statements.
any expert help in Excel?
I doubt this is your answer, but may help towards what you want. Based on #user3514930's approach:
With data as in the top left corner, select the two columns and click on DATA > Sort & Filter - Filter. Click on the arrow in the Column name cell and on (Blanks) in the dropdown. You should then see the equivalent of what is in the lower range. This can be copied and pasted elsewhere in the sheet, if you wish.

Excel chart dynamic range-selection

I have a client that has a simple yet complicated request for an excel sheet setup, and I can't for the world thing of where to start. I'm drawing a blank.
We have a data range. Example:
Quarter Data
2010Q1 1
2010Q2 3
2010Q3 4
2010Q4 1
I have a chart built on top of that. Change data, chart changes, protect worksheet to keep other idi... er... users from changing old data. Simple.
What I want to have happen: When I add the next Q1 below Q4, the chart "automagically" selects the most recent 4Q. So when I update the data to:
Quarter Data
2010Q1 1
2010Q2 3
2010Q3 4
2010Q4 1
2011Q1 7
The chart will show data for the last 4 quarters (2010Q2 thru 2011Q1). The goal being: keep "old" data on the same sheet, but have the charts update to most recent quarters.
I'm thinking: "fixed" data locations, reverse the data (new data at top), and just insert row each new quarter:
Quarter Data
2011Q2 9
2011Q1 7
2010Q4 1
2010Q3 4
2010Q2 3
2010Q1 1
But this will involve a lot of changes to the already existing excel sheets and I was hoping that there may be an easier/better "fix".
EDIT:
#Lance Roberts ~ Running with your suggestion:
- Little more detail... The data is setup such that the column information is in A, but data for multiple tables are in B+. Table 1 is B/C. Table2 is D/E. Etc.
- Data is also on a different sheet than the tables.
Going by: This Offset Description, what I've tried doing is adjusting similar to such:
NAME FORMULA OFFSET(range, rows, columns, height, width )
DATA0 =OFFSET('DATASHEET'!$A$2, COUNTA('DATASHEET'!$A:$A - 8, 0, 8, 1)
DATA1 =OFFSET('DATASHEET'!$A$2, COUNTA('DATASHEET'!$A:$A - 8, 1, 8, 1)
DATA2 =OFFSET('DATASHEET'!$A$2, COUNTA('DATASHEET'!$A:$A - 8, 2, 8, 1)
Goal being to tie the length/location for B/C/etc data to A. So if I add a column on A, stuff tied to Data1/2 adjust accordingly (or 3/4/5/etc, which are different charts on different sheets
)
I want data cells to be picked by the first row, and then an offset number to get data x columns over. Variations on the formula don't seem to be working.
1 issue I haven't solved yet: the data is not aligning properly:
"Data" is always, last column under 2nd to last Quarter. Last quarter is always empty. Data is shifting to the right (in this example, under 3Q10 - NOT under the correct column. 11 should be under 4Q10. 9.5 should be under 2Q10).
I know I'm getting something simple wrong...
Seems to be working. First thing I had to change was CountA - 9 (not CountA - 8). Next was the "column offset" (0, 1, 2, 3,...). Also split some stuff up to make it more compartmentalized (I do have to train someone else how to do this for her reporting needs).
Thanks Lance :)
If the chart is on the same sheet as the data:
Name the first cell of the data (A2) as a named range, say TESTRANGE.
Created a named range MYDATA as the following formula:
=OFFSET(TESTRANGE, COUNTA($A:$A) - 5, 0, 4, 2)
Now, go to the SERIES tab of the chart SOURCE DATA dialog, and change your VALUES statement to:
=Sheet1!MYDATA
Now everytime you add a new row, it'll change the chart.
I know this is an old question, but I wanted to share an alternative that may be easier.
Change your Quarter-Data range to an Excel Table. Select the range, and press Ctrl+T. In the Insert Table, make sure the correct data range is selected, and that My Table Has Headers is checked, and press OK. This converts the simple range into a special data structure with magical properties.
Then make a new range which links to the last four rows of this table, and create a chart based on this new range. This is illustrated below. The table is the specially formatted range in A1:B9 (you can choose a less in-your-face style), and the plotting range is D1:E5.
The formulas in cells D2 through D5 are below. Copy D2:D5 and paste into E2:E5 to complete the formulas in our plotting range.
D2: =INDEX(Table1[Quarter],ROWS(Table1[Quarter])-3)
D3: =INDEX(Table1[Quarter],ROWS(Table1[Quarter])-2)
D4: =INDEX(Table1[Quarter],ROWS(Table1[Quarter])-1)
D5: =INDEX(Table1[Quarter],ROWS(Table1[Quarter]))
Table1 is the name assigned to the Table, and Quarter is the name of the first column of the Table (and also the column header). You don't need to type all this, just select the column in the Table. As the Table expands or contracts, Table1[Quarter] keeps track of the changes.
Now add a new data point. The Table expands, and our little staging area in D1:E5 links to the new last four rows of the table.
And as we add years worth of data, the formulas and the chart keep up.

Resources