I have a data table, and this corresponding pivot table:
For each row in the pivot table, I'd like to know which field the row label refers to. So for the highlighted orange cell C17, I would like to return "First Name" (as you can see by hovering over cell A17).
I have some constraints that mean I need to use the pivot table in compact form. It would be easy if I could just use an outline or tabular layout, but I'm restricted to using a single column for my row labels.
Any ideas please? I'm happy to take solutions using either VBA or built-in Excel functions. Thanks!
In the highlighted cell, use the following formula: =IF(ISNA(MATCH(A17,$A$2:$A$7,0)),$B$1,$A$1)
This will work unless the Last Name also is a First Name that appears in your list.
Related
I am using excel sheet and i have data column as shown below:
As we can see that some of the names are duplicate or appeared twice. My question is how can count unique name records or rows associated with each name for summary column.
Out put i am looking for is shown below:
Not sure which formula to use as count is counting all of that data i.e. '7' in this case. How can i use count or any other function to count unique records as shown above?
You can do what you're after with a pivot table.
Click the Insert tab then select "Recommended Pivot Tables".
A window will open up prompting you to select the data range. I recommend using a named range for your list and referencing that, but you can just highlight the list directly if you want.
Once the data range is selected, click "Ok" and new window will open with exactly what you want. A unique values list and a "Count of Column1". It is the default of the recommended pivot tables.
I outlined this because it's easy and fast, but it's important to understand you can make this pivot table yourself from scratch if you learn about pivot tables in general. Pivot tables are often overlooked in Excel as an option.
Lastly, you could get really advanced with Excel Power Queries. Just Google "Excel Power query" and you will be shown all kinds of information on them. They are a close second place in power to manipulate Excel data short of using VBA.
Good luck!
CountA(Unique(D2:D8,,False)) = 5 [Count(Unique(D2:D8)) is the same as False is the default.]
CountA(Unique(D2:D8,,True)) = 3 (once and only once)
Note: the Unique function was released in late 2019 to Office 365. So if you want to use this check your version, not present in 1908, present in 2006.
Edit: It's actually in 2002, I just updated my 1908 machine.
HTH
If names duplicates are removed the following formula can be used: =COUNTIF(B:B,F2)
If duplicates must be removed by formula, MATCH (searches for a specified item in a range of cells, and then returns the relative position of that item in the range.) and SMALL (Returns the k-th smallest value in a data set.) functions can be used as shown.
C$1048576 is used to reference last row number for a big list case.
formulas:
Column A, names sequence
Colunm B, names
Column C, formula =MATCH(B2,B:B,0)
Column D, formula =IF(COUNTIF(C2:$C$1048576,C2)=1,C2,"")
Column E, formula =SMALL(D:D,A2)
Column F, formula =VLOOKUP(E2,A:B,2,0)
Column G, formula =COUNTIF(B:B,F2)
For anyone like me without O265's lovely Unique & Filter Functions, and who doesnt want to use a pivot table, and there are many ways to do this, but this i have just done this in normal excel.
List of data in Column H, Formula in column O3. Drag down. Highlights your distinct and unique values from H.
=IF(COUNTIF(H:H,H28)=1,"U - "&COUNTIF(H:H,H28),IF(COUNTIF(H$1:H27,H28)=1,"U - "&COUNTIF(H:H,H28),"-"))
Formula is short. You can just do this and drag down. Apply the same principal to your worksheet data wherever it is.
=IF(COUNTIF(H:H,H3)=1,"U",IF(COUNTIF(H$1:H2,H3)=1,"U","-"))
Similarly, you can just use this formula here (credit goes to this source for this one):
=(COUNTIF($H$1:$H1,$H1)=1)+0
Id like to point out that the above formula is a better formula than mine. It highlights with a "1" (or with a tweak, the value of your choice) the first time any value is seen/spotted on any given list, whether duplicate or unique.
Whereas mine is a bit "more random" when picking up the "unique and distict" values.
Mine gets there in the end, but Extend Office's gets there first, as I think is proper (getting the first time a unqique distict value is spotted/occurs.).
Formula in K5 =IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","") and drag down...
You could append/add a normal basic countif after the results to show how many actual times the given value appears if you wanted. :
=IF((COUNTIF($H$5:$H5,$H5)=1)+0=1,"UNIQUE DIST","")&" - "&COUNTIF(H:H,H5)
I have been struggling with this issue in the past days and haven't found yet any solution.
I have a simple table (not a pivot table) and some slicers attached to it. I want to 'simply' show selected value/values of the slicer in a cell. It implies of course to make the cell update automatically according to the selection.
Some of the solutions I found suggested using two pivot tables, one main for the regular data and the other hidden to capture the selected filters. The problem is that I am not working with a pivot table, but rather a simple table.
I also tried getting distinct values of the table column, but I couldn't perform it properly without getting the hidden values of the filtered table too.
Is there any way in Excel to do this simply?
Thank you!
You can follow the below steps to achieve your result
You will have to insert a serial number column in your table
After that insert the below formula above the header or anywhere you want to display the selected value
The formula in C2 is
=INDEX(Table1[Data 2],SUBTOTAL(5,Table1[S.No]))
Anybody has an idea why i cant use pivot table count value that is a number for a calculated field in that same pivot table?
Here is the picture of what i mean:
Count field in the pivot table counts how many of the certain Models are in a table and i would need to use the following formula: Count divided by Sum of IN in this pivot table.
Every time i try to use the value from "Count" column it returns the #VALUE.
It might be a formatting issue where excel is not understanding that one of the numbers is a number. There are a couple of ways to address the issue.
Highlight the cells, Home>Number, then apply the number format.
Select the pivot table,
in the pivot table fields box, select the dropdown arrow in the values section and select Value Field Settings
Then select Number Format and then choose the desired formatting (likely Number)
Force it as a value in your formula.
I assume your formula looks something like
=D4/C4 or
=GETPIVOTDATA("Sum of Sum",$A$3,"Top","Top","Name","Bottom
")/GETPIVOTDATA("Count of Count",$A$3,"Top","Top","Name","Bottom ")
you can use the VALUE() function to create
=VALUE(D4)/VALUE(C4) or
=VALUE(GETPIVOTDATA("Sum of Sum",$A$3,"Top","Top","Name","Bottom
"))/VALUE(GETPIVOTDATA("Count of
Count",$A$3,"Top","Top","Name","Bottom "))
Create a new 'Calculated Field' in your pivot table that does the function for you.
Select the pivot table, then Analyze>Calculations>Fields Items & Sets>Calculated Field
Give your field a name, then for your formula, enter something along the lines of Count/Sum of IN. Use the Fields box to make sure you get the Field names right
Hopefully one of these options will help you get what you need.
I am trying to condense data in a specific way. I want any occurrences of the number 1 in each column to show up as 1 (regardless of how many times it occurs) with the corresponding site, in the corresponding column. Some sites occur multiple times in the original data, and I want to make it so that only one of each unique site shows up in the resulting data table with a 1 for the corresponding column if there any 1's in the column from the original data.
I would think it would be a vlookup function, but I have tried many different things and I am really stuck on this.
Image of original data and what I am trying to do:
Thank you
This assumes that your data set only contains 1 or blank and this approach uses a Pivot Table with MAX function. Below are details in case anyone doesn't know Pivot Tables.
Select a cell in your data and insert Pivot Table. Note, I added a title for column A, as you need that in the Pivot Table.
Click in the created Pivot Table and the PivotTable Fields dialog should pop up. If not, right click in Pivot Table and select Show Field List.
Drag the Field names (Code, a, b,& c) down to the appropriate blocks below. (Values under Columns will be created for you.)
Click on the drop down arrow next to each field name and select Max. That will rename it to "Max of ...". If that bothers you, then you can type the name you want into the Custom Name field. Note, it will not let you type the same name as the field name, eg a, but it will work if you put a space in front of it.
Given that the Pivot Table would be a lot of work for a large number of columns, here is a formula based approach. Put this formula in cell G2, then drag it down and across to fill your new table.
Note, you will have to populate all codes that you have in column F. And if any new codes are added later you will have to keep this updated. One of the advantages of a Pivot Table is that it will do this for you.
I know that you won't be putting this in these cells, so adjust accordingly. In fact, I would recommend this be in another sheet.
=IF(COUNTIFS($A:$A,$F2,B:B,1)>0,1,0)
COUNTIFS($A:$A,$F2,B:B,1)
This will count each occurrence when the value in column A matches your code $F2 AND the value in column B equals 1.
If that count is >0, then you know that at least one match was found and the IF will return 1, otherwise 0.
I want to pull a list of people assigned to a particular trainer. In column A I have the trainer name, In column B the Last Name, In Column C the First name. I'd like a list in a different column which sorts the names under the name of their trainer. I've attached a picture of what I'd like. I typed in the information manually, so don't be fooled into thinking that I've already got what I want. I'm thinking that I might need to use Vlookup, but I'm not sure that's right or exactly how to do it in this case.
Thanks!
Here's the array formula to go into cell N2:
=IFERROR(INDEX(Table1[[#All],[Full Name]],SMALL(IF(Table1[[#All],[Trainer]]=N$1,ROW(Table1[[#All],[Trainer]])),ROW()-1)),"")
For this to work, you need to:
First turn your data into a table. Click any cell in your data then click on Insert > Table.
Copy the formula, then double click into cell N2, paste the formula and instead of pressing just Enter to save the formula, you need to press CTRL+SHIFT+ENTER. If saved correctly the formula will appear with {Curly Braces} in the formula
Fill the formula down enough rows to include all trainees. Then fill the formula across the columns for the other trainers.
It can be done a few ways:
Repeated applications of the Advanced Filter that saves the results to different locations. This is tedious to update.
Write VBA. This takes a while to learn.
Use an array formula. This is complicated to understand.
Use a Pivot Table. Doesn't give the exact layout you want, but is very simple to create and to update.
I'd suggest trying the Pivot Table using following steps:
Click on a cell in your data.
Insert > Table (using a table means the Pivot Table with automatically include all new lines added to your data)
Insert > Pivot Table and click OK
Add Trainer to Row Labels
Then Add Full Name to Row Labels
You can adjust layout if you want from the Pivot Table Tools > Design tab. I prefer changing Report Layout to "Show in Tabular Form" and changing Subtotals to "Do Not Show Subtotals"
After adding new rows to your table, right click on the Pivot Table and select Refresh.