I have a table with two columns, the first column has the neighbourhood name, and the second column contains a tree species. The table contains tens of thousands of rows (ie. there are multiple trees of each species in each neighbourhood) I need to know the number of different tree species in each neighbourhood. I got as far as using a pivot table to summarize and count the trees occurring in each neighbourhood, but the information that I am looking for is even more simple than this. How many unique tree species occur in each neighbourhood. I am using excel 2011 for mac. Can someone help me figure out the best way to do this?
With a PivotTable, one column for ROWS and the other for COLUMNS (either for Count of VALUES) you should only need to count the entries (either by row or by column, depending upon whether trees or neighbourhoods, and which you chose where).
If you don't want Pivot Tables, try the SubTotals feature as described by "rob" here: https://superuser.com/a/405569
You can also do this with the Subtotal feature.
Click the Data tab in Excel's ribbon toolbar
Click the Sort button and sort by your category column
Click the Subtotal button and fill in the dialog as appropriate, then click OK For example...
At each change in: Category
Use function: Sum
Add subtotal to: Cost of Goods Sold
i.e. have column titles in row 1, sort by neighbourhood, and subtotal "for each change in neighbourhood, use the count function and add the subtotal to trees"
Related
I have a sheet with a price list for many items, all of them have a column for category and another column for core product, secondary or third. I then have description, price etc.
I have built an Invoice configurator that when the user selects a category it comes up with an offset formula for product (description) and a bloom up formula then brings up the item code, price etc.
I have an issue where I am trying to get the spreadsheet to allow me to have the following.
1. Dropdown for product type.
2. Dependent Dropdown for category
3. Dependent Dropdown for product type
4. Then the offset formula to look at all 3 Dropdown options and only provide me with those products.
Does anyone have any ideas?
Thank you in advance
You can create dependant dropdown menus with named ranges, data validation and INDIRECT formula. Then use FILTER formula to extract the products corresponding to the 3 selected options. I've made a tiny example :
With blue background, the dropodown menus (2 dependants). On the right, the named ranges. On top, the data. With green background, the output (1 result only since my sample DATA is very small).
EDIT : You want a dropdown menu to select the results (after the user has done his 3 choices). You can use TEXTJOIN to build a list from the results and then create another dropdown menu (dynamically resized). If you want something more "transparent" (no table of results to hide), it's possible to replace the FILTER formula with SUMPRODUCT and MATCH (the TEXTJOIN column will be placed in the original table and might cause slowdowns if the number of items is too big).
Sheet
I have a spreadsheet of statistics from sports games over a season, for different leagues - each row holds a single event that happened in a game, such as a penalty. There are many rows of events for each individual game. One of the columns is the league, another is the home team and another is the away team. How can I count the total number of games in a given league? In other words, I would need to count the number of unique pairs of strings from Home and Away, where League = "Ligue 1".
EDIT
I have tried:
=SUMPRODUCT(1/(COUNTIFS(E2:E81078,"Ligue 1",F2:F81078,F2:F81078,G2:G81078,G2:G81078)))
which returns a DIV/0 error (it does work if I dont include the column E = "Ligue 1" criteria).
This is similar to your formula but deals with the division by zero
=SUM(IFERROR((1/COUNTIFS(E2:E81078,"Ligue 1",F2:F81078,F2:F81078,G2:G81078,G2:G81078)),0))
Enter it with Ctrl+Shift+Enter rather than just Enter. If done correctly you will see {} around the formula
Try not to use ranges that are bigger than your data because it will slow these kind of formulas down significantly
Update
This might also work if your data is ordered the way you show in your question. It counts the number of times the home team changes in Ligue 1 data :
=SUMPRODUCT((F3:F81079<>F2:F81078)*(E2:E81078="Ligue 1"))
Note that the ranges in column F are offset by one row
You can do this with a Pivot Table.
Add a "helper" column where you concatenate the two teams, preferably with a delimiter in between, eg:
=CONCATENATE(B2, "|", C2)
Use, for example Teams for the column header
Then, Insert ► Pivot Table and be sure to select to Add to Data Model
This adds the option for Distinct Counts to the Values Settings
Then Drag "league" to the Rows area, "Teams" to the Values area, and select Distinct Count for the Value Setting
You might get a table similar to below, which you can format in many different ways:
EXCEL SCREENSHOT=SUMPRODUCT(1/COUNTIFS($B$1:$B$7,B1:B7,$C$1:$C$7,C1:C7))
TRY THIS =SUMPRODUCT(1/COUNTIFS($B$1:$B$7,B1:B7,$C$1:$C$7,C1:C7))
I'm trying to make a spreadsheet of best mobile phones. They have different ranking such as Overall Rank, Camera Rank, Performance Ranks in different columns. What I wish to do is to have a single column with a dropdown list containing these options(Overall rank, camera rank etc) and sort the data depending on which one I choose
what you need to do is:
enter your data in 2 columns
in the first columns write the criteria such as (overall rank, camera rank and so)
in the next columns write the corresponding value.
mark the 2 columns
choose data tab from the ribbon, and then choose filter
you will see two small arrows in the first two cells in each columns
just press the one in the criteria column and check the box next to the items you would like to see ;)
I have a pivot table with column A which gives me a count of "Y's" from another worksheet. It either has a Y in the cell or it is left blank. For some reason the count is off by 1. I have another column B that has the correct count of Y's which is 55 while this column shows 56, any thoughts?
Note: Both column A and B should have the same count of 55. When I check the worksheet manually, they both have 55 Y's
A good way to fix and/or eliminate this issue from happening in the first place (counting empty cells) is by right-clicking on the pivot table, click on "value field settings" and instead of clicking on "count" pick/click" count numbers". Then right-click on the pivot table and click refresh.
This ensures that the pivot table counts cells that actually have a number in them and not merely a value that we can't see.
I faced this similar issue (of 1 less count for one element) and had to do some random pivot table counts of general items. Found two things:
Affects the count of the first element of a list.
It is because the the pivot table takes the first element of the list as the heading.(you can see it shows it as count of whatever the first element is).
SOLUTION
Add some heading above first element in the list and include it in the selection for the pivot table. The count should be correct after doing this.
(This issue of 1 less count which is unnoticeable for lists that you are not double checking counts by other methods can cause devastating issues and losses for engineering, monetary calculations etc.)
I am using an Excel 2010 pivot table to display data. I need the sub totals in most columns but some columns display percentages and totaling the percentages is not correct and displays confusing values. Is there any way I can choose which columns not to total.
It's hard to make sure I'm accurately addressing your question without more detail about your data, but I will provide a simple example.
Recommendation
I would suggest that you put all measures/values in the Values area of the Pivot Table, and not in the Row Labels. That way, you will not get Row sub-totals for values.
In order to address the non-additive totals and sub-totals for your percentages, I recommend that you remove the pre-calculated percentages from your Pivot Table Values and instead use a Calculated Field that is calculated within the Pivot Table itself from the base data, and will provide correct aggregate totals and sub-totals.
Example
See below:
Method
In order to create a Calculated Field using the Ribbon, select your Pivot Table, and then go to PivotTable Tools --> Options --> Fields, Items, & Sets --> Calculated Field.
Then, enter a name for the new Field (CalcPercentSoldUnits in my example below), as well as the formula definition for the field ( =UnitsSold /UnitsProduced in my example below). Click 'Add' to create the field and then 'OK' to exit the dialog box.
Now you have created a derived field not in your base data table, but in your Pivot Table, which can be used just like a normal field. You can also see that it will calculate totals and sub-totals correctly because instead of adding constants, it is calculating based on the sums of other constants from which the percentages are derived.
In some cases depending on how your data is structured, you may need to create a Calculated Item instead of a Calculated Field.
I hope this helps - if this doesn't address your situation, please post additional examples of your data and desired results. Thanks!
I have the same problem. Some Columns should be totaled, and others should not be. The only thing I figured out is to Grand Total all columns, then format those cells in the Grand total so that the font color matches the background color. This hides those selected Grand Totals from being viewed and/or printed. I experimented by expanding the Pivot Table rows, and the formatting for the selected cells followed into the new cell(s) and when I removed some of the rows, the formatting followed as well.
Wherever you don't want to show the total columns simply hide the column in the total section. I couldn't find any other way to do it.
Be careful about things like distinct/unique counts. This method helps with percentages, but you don't want to sum or average or otherwise aggregate unique counts. I would prefer to be able to just exclude a total for a single field but haven't found a method to do so.
I think I have a similar situation and a great answer for presentation purposes. I'm billing a customer for unbilled items; my pivot shows Qty, rate, and total missed revenue (qty*rate) for each month. Having a sum of Qty and Revenue makes sense for each month, but totaling the rates of the items doesn't. Pivot table and value options are an all-or-none solution. Rather, I just selected the totals I needed to hide and formatted them with white font color (blue for the grand total). My pivot table looks great now with this band-aid approach.