Group data based on count of duplicate values in a certain column - excel

I have an excel sheet that is organized as follows:
COL1 COL2
1 30
2 30
3 29
4 12
5 12
6 12
In the above, as you can see, values are being repeated in COL2. I need to group these values count and then place them in separate workbooks. So, for example, the output should be
Total Records: 2
1, 30, ......
2, 30, ......
Total Records: 1
3, 29, ......
Total Records: 3
4, 12, ......
5, 12, ......
6, 12, ......
Once that is calculate, I need them exported into separate excel sheets.
Can someone please help me figure out the best approach to do this? How may this be done in Excel?

You can create pivot tables to do this. Create one pivot table for all your data, then duplicate and separate one pivot per value in Column 2. Put each of those pivots in the new work sheets as you need. If you need help with setting the pivots up, please take a look at this site.
This can also be done in VBA, if this is a large task or something you will need to do on a regular basis. Since you didn't ask for the VBA, I'll assume for now that you mean to do this manually.

Related

EXCEL formula to sum demand per date when multiple entries of dates exist

How do I sum the amount of demand I have for each date, when there are multiple entries for each date., e.g.
Sheet 1:
A B
Date Demand
13/7/21 5
13/7/21 4
13/7/21 2
15/7/21 6
15/7/21 3
16/7/21 2
16/7/21 4
So I'm trying to get a summary as follows:
Sheet 2:
A B
13/7/21 11
14/7/21 0
15/7/21 9
16/7/21 6
17/7/21 0
I've tried =SUMPRODUCT(--('Sheet 1'!$A$2:$A$240='Sheet 2'!A2),'Sheet 1'!$B$1:$B$240)
I'm not wanting to do a pivot table, as the pivot table does not give me the zero values for dates where there is no data (unless there is a way to show this in a pivot)
You can use SUMIFS() like
=SUMIFS(Sheet1!B:B,Sheet1!A:A,A1)
You can also use SUMPRODUCT() in this way.
=SUMPRODUCT((Sheet1!$B$2:$B$8)*(Sheet1!$A$2:$A$8=A1))
Put together quickly to start you off:
Edit to give text version of the solution to the OP's problem:
=SUMIFS(B6:B12,A6:A12,"="&G12)
Then you can do between by setting lower and upper criteria in the sumifs().

Use a Count field as a row in Excel Pivot table

Not sure if it is possible but I'd like to have a pivot table that summarizes how many occasions properties have been missed, and then shows the number of times properties have been missed that many times.
What I'm looking to end up with is something like the below:
TIMES MISSED PROPERTIES MISSED THAT AMOUNT OF TIMES
1 102
2 76
3 23
4 11
5 2
Information is currently in the following format:
UPRN DATE MISSED
1029292 1/1/2020
1029292 5/6/2020
1010101 1/2/2020
1046353 4/3/2020
3894387 8/2/2020
3894387 7/2/2020
3894387 9/2/2020
So this would give the following table:
TIMES MISSED PROPERTIES MISSED THAT AMOUNT OF TIMES
1 2
2 1
3 1
Is this possible? And if so, how?
Pivot tables in Excel can summarize data not only with SUM function, but also with COUNT and other functions.
Right-click a field in the "Sum values" field chooser and then select Value Field Settings... From there you can choose the function to summarize your data (COUNT in your case).

I want to use sumproduct on two different tables based on 3rd Table

I'm a Boy Scout Assistant Scout Master and was asked to help with a fundraiser so I'm trying to put together a Excel sheet. I would like to use sumproduct to pull together the totals I need from two tables. My result would be in B3 in referenced pic.
Math:
(C7 * B18) + (C14 * B19)
or
(.19672 * 300)+(1 * 200)
Result of 259.02
Need
Table 2 Dist Hours
Table 3 Total
From
Table 1 Name = $A$3
Table 1 Name = Table 2 Name
Table 2 ID = Table 3 ID
I hope someone can help our Boy Scout Troop (me)
Try the following formula, which needs to be confirmed with CONTROL+SHIFT+ENTER, not just ENTER...
=SUM(IF(B7:B14=A3,SUMIF(A18:A19,A7:A14,B18:B19)*(C7:C14)))
Adjust the ranges accordingly.
For a finite (and static) number of entries in table 3 this method of stacking error controlled lookups should produce the correct result for any name put into table 1.
=IFERROR(INDEX(C7:C14, AGGREGATE(15, 7, ROW($1:$8)/((A7:A14=A18)*(B7:B14=A3)), 1))*B18, 0)+
IFERROR(INDEX(C7:C14, AGGREGATE(15, 7, ROW($1:$8)/((A7:A14=A19)*(B7:B14=A3)), 1))*B19, 0)

Show sales figures over time per employee

Assume the following data:
day employee sales
1 a 0
1 b 10
1 c 10
2 a 5
2 b 7
2 c 10
3 a 3
3 b 3
3 c 5
I would like to have a chart with on the x-asis the days (1, 2, 3) and on the y-axis the number of sales. Each employee should have its own line, so they can be compared.
I am unable to get a chart like this. I expect to get 3 lines when selecting all data, but Excel returns 1 line per data-row instead. It does not, so to speak, group the sales by employee. How can I get the chart I want? Is it even possible?
Any help is greatly appreciated :-)
Have you tried a pivot table or pivot chart? Just drop your employee name in your row section, sum your sales, and I think that's what you're looking for.

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