How to create a count table of two variables in excel pivot - excel

I am struggling with creating a count table of two variables at the same time. Ultimately, I would like to create a bar graph of the table.
Assuming I have two items for a sample of firms and I just want a summary table of the answer count.
Firm Item1 Item2
1 1 1
2 2 1
3 1 2
4 1 2
Based on this answer, I can easily create the summary table for Item 1 telling me that "1" appears three times for item 1 and two times in Item 2. But I cant easily create a Pivot table showing this jointly.

I'm not sure I understood correct, but is it COUNTIF() you need?
In D1 type:
=COUNTIF(B:B, "1")
that should give you result 3

Related

Trying to automate the numbering of Excel rows, but only semi sequentially, based on conditions

I'm trying to get a system set up on a data compilation sheet in excel. Going in and adding all the new information, and then deleting the old information has become extraordinarily tedious. I'll type out what I'm trying to accomplish, as an example.
A
B
C
Name
Date
Desired AutoNumber
Item 1
01/17/23
1
Item 1
01/17/23
1
Item 1
01/17/23
1
Item 1
01/06/23
2
Item 1
01/02/23
3
Item 1
01/02/23
3
Item 2
01/17/23
1
Item 2
12/24/22
2
Item 2
12/16/22
3
Item 2
11/18/22
4
Item 3
01/16/23
1
Item 3
01/16/23
1
Item 3
01/13/23
2
Item 3
01/11/22
3
Item 3
01/08/23
4
Item 3
12/26/22
5
Item 3
12/26/22
5
Wanting to use this format, as the most recent 5-7 dates per item are needed to remain. (This is for an online games' external assistant system)
What I've found either only numbers the rows based on item name, or based on the dates per item name, which isn't what I'm trying to make happen. What I've used so far is:
=countif($A$2:A2,A2) (which numbers based on item name) or
=countifs($A$2:A2,A2, $C$2:C2, C2) (which numbers based on the dates per item name, which is closer to what I'm looking for, but not in the right format)
By also adding in offset, it does the same thing.
=countif(offset($A$2:A2,0,0),A2)
I'm not sure if there's even a way to number it the way I'm looking to, since it's not numbering within a specified date parameter. I've been trying to do this without using a macro, since the information is going into a larger database, and certain information can't be deleted. Is there a way to do this using a formula?

Keeping rows based on source rankings in excel?

I have a table that looks like this -
Source Rank
Value
1
A
2
A
3
A
2
B
3
B
1
C
2
C
3
C
I want to make only keep the rows for each value with best rank. So the table will look like this -
Source Rank
Value
1
A
2
B
1
C
It's almost impossible to find a better argument for the invention of the "Subtotals" feature, as you can see:
Oh, in case you don't get the same results immediately: don't forget to click the 2 button in the left margin :-)
Create a Pivot Table from the source data, and set:
Row Labels: Value
Values: Source Rank - and use the pulldown to set to Min
Admittedly this will have the columns the other way round from what you show as ideal result.

Counting multiple values in a range to group by category and making a pivot table with slicer

I've been Googling at this for days and I can't seem to wrap my head around it and am not familiar enough to figure it out. I have a table of data. I have a list of categories with multiple codes for each category. Each row in my table has 100 columns than can have category codes in them. They can be blank or have different codes from the same category but no duplicate codes. Here is a small example
val1
val2
val3
val4
val5
val6
user1
3
5
3
6
4
7
user2
6
5
8
2
4
5
user3
7
7
5
3
7
0
user4
1
4
7
3
9
2
I am trying to make a pivot table to count the number of times codes are present for each category. Initially, I created additional columns in the data table, one for each category, that used COUNTIFs to look in all the columns per row and add up the categories. The additional columns look like this:
cat1
cat
cat3
user1
3
5
3
user2
6
5
8
user3
7
7
5
user4
1
4
7
So for example, if you count up all the codes belonging to cat1 for user1 (columns val1 - val100) it would be 3. The problem with this is when making my pivot table the columns are labeled "sum of" followed by category name, but more importantly, I can't make a slicer by category. I can make a slicer for one category and it lets me filter by the number of times the values appears in a row (0,1,2,3, etc).
I made another table with the codes in one column (unique) and the categories in another (not unique), but I just can't figure out how to get my pivot table working. I've been reading about adding a measure and using a DAX formula but I don't know if that's the right approach and I'm not familiar with them either. I need a pivot table because I eventually will turn it into a graph with slicers. Can anyone point me in the right direction?
Seems like your only Option is to Do the CountIF at the end of the table
or Reconstruct your source Table
Like
and then you pivot that like this
Lastly you can pivot that base on your second table
Your second Option is to

Multiple Calculated Columns with Filters within Single Pivot Table

I am working to create a Pivot Table in Excel that has multiple calculated fields that take into account whether a condition is true, but cannot figure out how to create this within a single Pivot Table.
Behind the scenes, I have a set of data with a column that can have these values: A,B,C,D,F,L, or R.
I have another column that is a dollar value, and another for Quantity.
I am trying to calculate the price per unit when the Category is A,B, or C, but also calculate the price per unit when the Category is D.
I can create multiple Pivot Tables and tie them to the same slicer, but the issue is this: I need to display the spending in each of the two categories for each location, and when I create two separate Pivot Tables for this, locations that do not have spending in one of the categories are excluded (in this below case, location 2 has no spending in Category D, so it does not show up in the second Pivot Table).
Here is a portion of my data set. The whole data set is over 100,000 rows and will change over time, so I do need a solution for the long-term.
Location Category Volume Quantity
1 A $120.32 6000
3 A $30.08 1300
3 A $60.16 2600
1 B $39.91 1000
2 B $318.50 13000
2 C $196.00 8000
1 D $220.50 8100
3 D $171.50 6300
3 D $35.90 1000
3 D $53.85 1500
2 F $416.50 0
1 L $24.50 0
2 L $30.08 0
1 R $55.13 0
2 R $55.13 0
3 R $110.26 0
Thanks in advance for your help and let me know if I need to clarify anything!
Alright, a little more digging yielded the answer.
A slicer should be included that has all locations selected, then it should be tied to all Pivot Tables in use.
For all Pivot Tables, go to Field Settings, then click on the Layout and Print Tab. Check the box 'Show items with no data'.
Then go to Pivot Table Options and select the values you would like to display for blanks and errors.
I found the solution here.

Excel: filter table rows by specified column value

I have a table with first column as primary key. Ex:
id value1 value2
1 10 5
2 2 3
3 12 5
..
I also have a second list of id's I want to select, which can have repeated ids. Ex:
selectId
1
2
2
2
5
10
..
How can I "merge" the two tables (something like INNER JOIN) to obtain:
id value1 value2
1 10 5
2 2 3
2 2 3
2 2 3
5 99 99
10 22 22
..
I tried using 'Microsoft Query' from Data > Extern Data to join the two tables. The problem is that it seems it cannot handle tables with more than 256 columns.
Thanks
UPDATE:
Thanks, VLOOKUP works as intended.
However one problem is that if the row was found but that corresponding column was blank, this function returns 0 (where I expected it to return an empty cell), and since zero is a valid value, I have no way to differentiate between the two (blank and zero)?
Any help is appreciated..
If this is Excel -like the title says- just use vlookups.
Not very relational, but that's the Excel way.
Using the VLOOKUP function would get you the data in the layout you require.
If you are using Tables in Excel 2007, the formula would look like this based on the example below.
in cell B8
=VLOOKUP([selectId],Table1,2,FALSE)
in cell C8
=VLOOKUP([selectId],Table1,3,FALSE)
Lookup screenshot http://img208.imageshack.us/img208/1/lookupz.png
It is not clear where you store your data, but it looks like you have this problem, described on Microsoft site:
http://support.microsoft.com/kb/272729

Resources