I have a list of items in one column and a total number in another column. I need to combine every instance an item appears in column A and the amounts in column B. I also need it to sort by highest number first on its own if possible. Here is an example of what I mean.
Column A & B is my list, Column D & E is what I want the results to look like:
Can anyone help out? I've racked my brains for days and cant seem to get it to work. Thanks.
This is what pivot tables do...
Create a pivot table Image below.
place cursor in D2
Menu - Insert
Tables - Pivot table
Select range of data
fill out fields on right as in image. (I had A on line 2 = 3 so my total said 14 and didn't refresh before I took the screen capture)
right click on a value in the sum of total column and click sort from popup and select largest to smallest.
Related
A simplified example of what I am looking for is a quick way (either a tool or a keystroke) to fill a table where every 5 rows of the first column has a different operator name. The fill would place the first name into the first 5 rows of the table, the second name into rows 6 - 10, and the third name into rows 11 - 15. The images below are a visual representation of before and after the fill.
I am aware of different ways to fill the rows one operator at a time in this example, but is there a way to fill all three in one go? This would be very helpful in larger scale situations. Thanks!
Excel table before filling column A
Excel table after filling column A
Open PowerQuery (Go to Data on the ribbon, Get Data -> Launch Power Query Editor ...) and use Fill Down ...
Result
I need to pull repeated values from a table and copy information from my Row 2 as many times as there are items returned. The example makes more sense. Here is a truncated example of the table with my data:
This is what I want to pull it into:
And the desired outcome:
My hope is I could enter "food" into the first Category cell, a name into the first Name cell. If I have 170 things in the "food" Category, it would have 170 lines of "food," 170 prices, 170 items (in my list the items are all unique), and 170 lines of "Megan," or whatever name I've entered there.
I can use INDEX and MATCH to fill out the first line of Price and Item, but if I repeat that formula it just gives me the same thing in every row. I've found ways to almost do what I want with SMALL, LARGE, and COUNTIF, but all of those return the entire list, ordered. That would mean I would have to go through and delete all the "shoes" and "books." Each of my categories will be saved in a separate file.
The table can be sorted A to Z. Perhaps there's a way to find "food," COUNTIF(?) how many times it appears, and then copy that many cells from the table to my new table? In other words, "food" first appears in A2, appears 170 times, copy everything from Table1 cells A2 to A172, print in Table2 cells A2 to A172, repeat value in D2 ["Megan"] 170 times?
UPDATE: I figured out a workaround but it could be better. I would love to find a way to pull in all the 1000+ of each item from the pivot table, rather than having to select them all by hand. This is what I'm doing now:
I put the first table's values into a pivot table, then I selected all of the "items" in each category and pasted them into my new table.
Thanks to this question, I used =IF($C2<>"",D$2,"") to fill the rows with the appropriate data, where C is Item and D is Name. It's not exactly "automated," as I had to drag the formula down 1100 cells, but all I have to do is paste the individual Items from my first table and column D copies itself.
For Price, I used this: =IFERROR(INDEX(Table1[Price],MATCH([Item],Table1[Item],0)),"")
Similar formula for Category. Again, not exactly automated.
You should consider use power query.
https://www.contextures.com/excelpowerquerycombinetables.html
This should work.
you can create the queries table for the price items and the name.
I created tbl_item and tbl_name as below.
Then i go to New Query > Combine Queries > Merge. Which should like the figure below. highlight the column where you want to base on to merge. in this case is based on category.
Click OK and you will have what you want.
Hope this help.
for a formula you might want to use this: ARRAY FORMULA: CTRL + SHIFT +ENTER
=IFERROR(INDEX($A$1:$C$7,SMALL(IF($A$1:$A$7=$E2,ROW($A$1:$A$7)),ROW(A1)),MATCH(F$1,$A$1:$C$1,0)),"")
You can adapt the ranges to your needs. I copied the formula to F2 and pulled it sideways and downwards. If you need help, just say so :)
Is there any condition for Megan?
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 have excel sheet contain 600 thousand row, I want to select one column.
for example please see the attachment picture
Here in the column there are multiple values, I want to count it and the result must be for example
number of value 1 it's = 55
number of the value 8 it's = 23
seems this to do it's easy but I have 600 thousand with multiple values.
It all depends on how many times you have to change the column and what you have to do with the informations you get.
Without this info the best solution is the following:
select the column you have to analyze;
push Insert;
hit Pivot table
select Pivot Table.
Now you have only one field that you can put inside ROWS and inside VALUES (select COUNT).
This will give you an unique list of the elements and the amount of each one.
I have a spreadsheet with ~8000 records, there are ~400 unique identifiers (i.e. element 101, 102, 103....500) that I need to calculated means for. Is there a simple way to calculate means on large datasets like this?? Or will I have to do =average('select column block') for each subgroup/unique identifier?
Many Thanks
Use the following formula
=AVERAGEIF($A$1:$A$8000,"=IDNUMBER",$B$1:$B$8000)
Where
Column A is your column of ID numbers
Column B is your list that you need the mean from.
If your ID numbers are sequential, you can set up something like:
=AVERAGEIF($A$1:$A$8000,"="&100+row(A1),$B$1:B8000)
And copy that down from say C1 to C500
Alternatively you could make a list of the unique identifiers with another formula and place that unique list in C1 to C500 and then in column D use the following:
=AVERAGEIF($A$1:$A$8000,C1,$B$1:$B$8000)
If you have a header row you will need to adjust your ranges accordingly
The formula to generate a unique list of IDs is:
=INDEX($A$2:$A$8001,MATCH(0,INDEX(COUNTIF($C$1:C1,$A$2:$A$8001),0,0),0))
Use that in column C but in row 2 and copy down. So if your data starts in row 1 you will want to bump it down 1 row.
Create a pivot table with the unique identifiers in the rows and calculate the average of the values.
For data that is clustered up nicely and immediately ready to be handed off for a visual review of the averages try a creating a Subtotal:
Select your data
Go to Data > subtotal (far right on the tab)
On the menu popup in the At each change in field, select the column header name that corresponds to your unique identifier.
Select Average for Use function. Select the checkbox of the column for which you want to find the group's mean.
Select other formatting features if desired (defaults typically work best)
Click okay.
Take a sip of coffee and let the magic happen.