Counting grouped cells excel - arrays

Currently I have a excel table that looks like this
A B C D E F G
ID NAME DATE ITEM 2020 3
1234 Alex 09-20-2020 Carrot 2019 2
1234 Alex 09-20-2020 Onion
1234 Alex 09-20-2019 Carrot
1234 Alex 09-20-2019 Mushroom
1234 Alex 09-20-2020 Pasta
1345 Morgan 09-20-2020 Pasta
1345 Morgan 09-20-2020 Tomato Sauce
1145 Jayson 09-20-2020 Tomato Sauce
1145 Jayson 09-20-2020 Cream Sauce
1345 Morgan 09-20-2019 Pasta
1345 Morgan 09-20-2019 Tomato Sauce
I want to be able to count the unique customers for each year using excel functions. This is so that the functions can be transferred to a different computers without setting up the custom functions.
The proccess currently can be done in excel without function by: adding filter to each column, filtering to only show the intended year, using remove duplicate to remove duplicates in NAME, and finally counting the rows (giving reslts seen in G2 & G3). However, I want to be able to do that through excel functions. So far what I have is that I am able to count unique values through
{=SUM(IF(FREQUENCY(IF(LEN(B2:B12)>0,MATCH(B2:B12,B2:B12,0),""),IF(LEN(B2:B12)>0,MATCH(B2:B12,B2:B12,0),''))>0,1))}
Additionally I am also able to SUMPRODUCT() for counting a array with multiple condition so for now I have combined the above forumla with
SUMPRODUCT((YEAR(C2:C12)=G1)+0)
My initial idea was to add the first function into the SUMPRODUCTI() since the first function could also produce a array that it could count. However that quickly did not work as it did not count the unique values corresponding to the year.
My question here is if there is any way to what would be a grouping function so that I can take unique values that are within a year, without transforming the data (through filters of deletion of duplicates). My current understanding with SUMPRODUCT() is that it will only look for unique values in the entire column but not within the range given for the first array.

You have got numeric ID's which you should make use of. If you have got Excel O365, in G1 use:
=COUNT(UNQIUE(FILTER(A$2:A$12,YEAR(C$2:C$12)=F1)))
With older versions, use this CSE-entered formula:
=SUM(--(FREQUENCY(IF(YEAR(C$2:C$12)=F1,A$2:A$12),A$2:A$12)>0))
And drag down.

Related

Is there a function or a solution to source from different sheet (and file) based on criteria? WITHOUT VBA

What I am basicaly looking for is a way to lookup data from 1 sheet/file named "Sheet 2021" in case the part of lookup value is "XYZ/21" and for it to look in "Sheet 2022" from another file in case the lookup value is "XYZ/22" In addition to that it needs to have multiple criteria as the 2nd lookup value is a 10 digit code.
Example:
I have sheet called "Claims 2022" and Sheet called "Claims 2021"
Listed values in 1st (RMA 2021):
RMA
Date of issue
Item Number
Finished?
28/20
2/5/2020
1234567890
Yes
1/21
3/6/2021
1234567890
No
1/21
3/6/2021
0987654321
Yes
1/21
3/6/2021
1111111111
No
1/22
1/1/2022
2222222222
Yes
Listed values in 2nd (RMA 2022):
RMA
Date of issue
Item Number
Finished?
14/21
11/12/2021
1234567890
Yes
2/22
3/7/2022
1234567890
No
20/22
3/6/2022
0987654321
Yes
20/22
3/6/2022
1111111111
No
22/22
4/8/2022
2222222222
No
I want to:
extract these in a single file based on the date (If it is issued in 2021).
And then extract the value for "Finished".
The reason that numbers do not match the year is because the supply chain program lists them out based on the date of arrival. And I cannot influence or add anything to the source excel.
I don't want a brute force solution such as "if date 21 then 21" through a helper column as the file is gonna expand with other years.
Perhaps there is a function or a possibility to change the source depending on value?
For example:
[Source.xlsx]RMA `<value>`'!$C$3:$C$150
Where <value> would change based on 2020,2021,2022...
Or perhaps there is a more intuitive solution?

angularjs show table per field

I want to show the results of a MySQL query on my website using angularjs. For now, I'm showing them using a simple table with ng-repeat and it works with no problem. But because the data is a lot, I wanted to ask if it is possible to create multiple panels or tables per specific field.
To be more specific, I have 4 fields returned from the query: name, address, occupation, department. Right now I have a table such as:
George Smith Nikis 10 Project Manager Finance
Maria Bexley Lincoln 20 Project Manager Research
Chris Liggs Forks 123 Programmer Computer Science
etc. I want to know if I can create as many panels or tables as the unique values of the "occupation" field are and then show the results per that unique value inside each panel/table. So instead of the above table I would have something like:
Project Manager
George Smith Nikis 10 Finance
Maria Bexley Lincoln 20 Research
Programmer
Chris Liggs Forks 123 Computer Science
I think you need to use groupby filter
Check this fiddle by Darryl Rubarth, it contains the answer you need
http://jsfiddle.net/drubarth/R8YZh/
<div ng-repeat="item in MyList | orderBy:'groupfield' | groupBy:'groupfield'" >
You can use group by filter in ng-repeat with which you need to group

Aggregating grouped data with repeating data

I am trying to figure out how to aggregate the number of hours a person worked that is repeated by each fringe code that they have.
The data looks like this
Company Code Employee Code Employee Name Hours Fringe Code Fringe Amount
030 12345 Joe Blow 8 VAC 10.00
030 12345 Joe Blow 8 DUE 5.00
030 12345 Joe Blow 8 INTDUE 2.00
030 54698 Alan Low 8 VAC 10.00
030 54698 Alan Low 8 DUE 5.00
030 54698 Alan Low 8 INTDUE 2.00
Now the total number of hours should by 16. In the report I have grouped the following fields Company Code, Employee Code, Employee Name, Hours so that they only appear once (not sure how to show that).
I tried to do the following
Sum(FIRST(Fields!Hours.Value, "Employee_Name") , "Company_Code")
but I get an error saying that the value is using a First aggregate in an outer aggregate and that they cannot be specified as nested aggregates.
Any ideas?
I am not sure what you want so I guess a possible result scenario.
I 've reproduced the providing input table.
Using this tablix data settings:
Add this code to the report. This function will flag those rows that must be summed.
Dim groups As System.Collections.Hashtable
Function MyFunc(ByVal group As Object) As integer
dim flag as integer
If (groups Is Nothing) Then
groups = New System.Collections.Hashtable
End If
If (Not groups.Contains(group)) Then
flag = 1
groups.Add(group, nothing)
else
flag = 0
End If
MyFunc = flag
End Function
And this expression in the tablix textbox you want to put the sum.
=sum(val(iif(Code.MyFunc(Fields!Employee_Code.Value) = 1, Fields!Hours.Value, 0)))
You'll get this preview
Let me know if this was helpful.
Well I had issues with some of the above suggestions but I figured out how to solve the problem.
I used the following equation:
=SUM(MAX(Fields!Regular_Hours.Value, "Employee_Code","Company_Code")
Thus I used the MAX function to get only one occurrence per Employee Code and then did a sum of that one occurrence over the Company Code grouping.
Thanks for your guys help!

Vlookup array multiple columns

Excel wiz's,
I'm trying to build a report with a simple drop down list of names. Rather than try to explain in more detail, let me give you a sample dataset:
Table1:
Text Person1 Person2 Person3
String here contains name(s) Mike Smith Robert Johnson Suzy Q
Another string with name(s) Dan Boy John Michael Bob Wise
Different string with name(s) Robert Johnson Suzy Q
In my report sheet, I have a drop down list of all the possible "persons" that I want to chose from and then return all values from the "Text" column in an array. I have been able to make it work with only one column using this formula, where C4 contains my choice in the dropdown list:
INDEX(Table1[#All],SMALL(IF(Table1[Person1]=$C$4,ROW(Table1[Person1])),ROW(1:1)),1)
The text column will contain all the names of the Person columns, but they are in a different case (all caps, can't change format for display purposes). Maybe a SEARCH function would be more useful? I'm not sure. I'm trying to avoid using a macro, but I am not completely opposed.
Let me know what you guys think, and thanks in advance!
Simply re-organize your table so that there's one row per name... the V-Lookup on the name and get the matching list.
Person Text
Mike Smith String with names
Robert Johnson String with names
Suzy Q String with names
Dan Boy Second string with names
are you trying to make validations for teams? like select team, then next drop down gives only members of that team?
you can use offset inside validation. in one cell put a validation for the list of teams. in the other cell, create a list validation, use a offset formula to return the range of members based on the selected team.
edit: not sure how to put in a table, but this is how you would fill a range with vlookup
in the table with the entries, add a column with serial number starting from 1-n
just below the drop down box, enter numbers 1 to n in order
vlookup the serial number in the table, that is the row you are looking up
for the column, use a match to look in the table which column the current selected person is
drag the formula down to fill n numbers

Human Name lookup / translation

I am working on a requirement to match people from different databases. One tricky problem is variance in names like Bob - Robert, Jim - James, Lizzy - Elizabeth etc across databases.
Is there a lookup/translation available for this kind of a requirement.
Take a look at my answer (as well as the others) here:
Tools for matching name/address data
You'd need to implement a lookup table with the alternate names in it:
Base | Alternate
----------------
Robert | Bob
Elizabeth | Liz
Elizabeth | Lizzy
Elizabeth | Beth
Then search the database for the base name and all alternates. You'll end up with a number of multiple matches which will then need to be checked to see if they really match based on a comparison of whatever other data you have in the two databases. Maybe the dates of the records in each database could be used - records entered close in time indicate the same person.

Resources