Compare and Compile data from various Columns into 2 columns - excel

Im having some difficulties with getting excel to do what I want.
The situation im in:
Every week, i get a report of about 500 worker IDs with some values. These IDs and values does not come with the name of the worker. So what im trying to do, is to have Excel search for the IDs in another column and the return the worker name from 2 columns (first and lastname).
The layout:
A: Workers Name
B: Worker ID
D: List of IDs without name
E: list of values, that the worker has produced throughout the week.
Result should be something like:
If Worker ID from D exits in B, then it would take Worker name from A and the value from E into G and H.
G: Worker Name
H: Value from E matching the same ID from E.
Is this even possible? Since i havent been able to figure out a suitable solution, which would make my job a lot easier and make me able to use more time on actual work, than on getting excel to work as i want it to.
I have been looking at VLOOKUP, but havent been able to wrap my head around, how it would be possible to make it work.
Any help is appreciated.
Layout of Sheet

If I understand correctly:
Vlookup() is a nice function, but you cannot return a value from column 1, by looking for data in column 2. You want to use Index/Match.
A quick test: Say your ID you want to look up is in X2, and your columns are as outlined...try this =Index($A:$A,match(X2,$C:$C,0)) which should return the First name for the user.
To get the second name, just combine two formulas together with a separator: =Index($A:$A,match(X2,$C:$C,0))&", "&=Index($B:$B,match(X2,$C:$C,0))
Edit: Hm, here's a screenshot to hopefully clarify if I understand your question, and you can see how the match should work:
So, as you drag that down, in H4, it looks for m59908 from Column D, searches for it in column B, then returns the name from Column A of that row.

Related

Excel: Calculations with two variables, that both share the same ID

I have been working on a little project in which I analyze some data from a game that I play. My dataset looks like this:
As you can see, it consists of:
Match ID
Map the match was played on
Team name
First pick, second pick and third pick (characters/players)
Points the teams won from this match
What side they played on (A or B)
Who won
Whether they're in the top 64 teams
Currently I am trying to analyze how certain picks perform against other picks. For example, I would like to see how the Xelor first pick (cell D2) performs against all other first picks. To do this, I would need to count the amount of times the Xelor first pick played against all other first pick, and how many times the Xelor pick won. I don't have any problems doing that, but the catch is that I need to make sure I only compare the Xelor first picks with other first picks from the same match (same match ID). For example, I would compare the Xelor first pick (D2) vs the Steamer first pick (D3), as they share the same match ID.
I came up with a messy solution earlier with simple formulas, but it made for a table that had no data every other row, which resulted in some problems analyzing the data. I am now struggling with the Index and Match functions to make a pretty table for my needs, but I am having a hard time.
If anyone could give me a hand on how to do this, or has any clever ideas on how to analyze all picks vs other picks, let me know!
So, it turns out that both the Unique function and the Xlookup functions made this an easy problem to solve.
First, I made a new column showing just the unique match ID values:
=UNIQUE(A:A)
Then, next to that column I looked up the first pick of the A side team using Xlookup:
=XLOOKUP(M2;A:A;C:C;;0;1)
I then did the same in another column for the team on the other side using an inverse search direction:
=XLOOKUP(M2;A:A;C:C;;0;-1)
Lastly, to see which of the two first picks won, I used this formula in a fourth column:
=IF(XLOOKUP(M2;A:A;H:H;;0;1)="Win";N2;O2)
This resulted in the following table (M:P):
Thanks for the help, David!
You could try something like this in M2 cell:
=IF(L2="","",COUNTIFS(TB_GAMES[W/L/D],"Win",
TB_GAMES[Pick 1],L2,TB_GAMES[Match],$K$2))
Then you can expand the formula down.
In L column you have the unique values from users given the Match (K2) and the Pick 1 column values.
=UNIQUE(FILTER(TB_GAMES[Pick 1], TB_GAMES[Match]=K2))
Update
In case you want to calculate the scores for all the Pick 1 players at once. You can try the following:
=LET(winSet, FILTER(TB_GAMES[Pick 1], TB_GAMES[W/L/D]="Win"),
matches,XMATCH(winSet, UNIQUE(winSet)),
freq,FREQUENCY(matches, UNIQUE(matches)), SORT(HSTACK(UNIQUE(winSet),
FILTER(freq, freq<>0)),2,-1)
)
Note: Because we are using a FILTER function we cannot use as range input argument for COUNTIF or COUNTFS, so we try to use XMATCH/FREQUENCY as a way to achieve the same result. For more information about this see my answer to the question: How to count the number of trades made on a Excel spreadsheet using a custom conditional formula?, we use here the same idea and the explanation would be the same.
The HSTACK function is used just to combine the result having the winners and the number of wins for each player. Finally the result is sorted by score.
This would be the result on O2 cell:

MAXIFS function that increments to return 2nd,3rd largest numbers

I have a column called Paid which consists of currency figures which is in column A.
I also have a column called ID to uniquely define each of the rows which is in column B.
I am trying to make a top ten list of the highest results from this column.
For the first result, I use a simple MAX function.
For the following, I use
=MAXIFS(Combined!$A$1:$A$2916,$A$1:$A$2916,"<"&$C1)
where C1 is the first result in the top 10 list.
THE ISSUE: Currently, if two results are equal in Paid, one will get skipped and not be on the list.
I've tried using something in the nature of
=MAXIFS($A$1:$A$2916,$B$2:$B$2916,"<>"&$D1)
where D1 is the ID of the 1st in the top 10 list.
My issue here is that I want to use a condition to say that none of the ID's in the B column appear in the above entries in the D column(IDs of the top 10) and I don't know how to do this without brute forcing and writing each cell into each condition.
Is there a smoother way to write a "not in" check in a maxif function?
Thanks
For reference, an example of what I want would look like:
Example Data
Maybe try:
Formula in C2:
=INDEX(SORT(A2:B11,1,-1),SEQUENCE(10),{1,2})
Where 10 is your top N figure.
Note: The above works fine in retrieving only 10 figures, yet if you insist you want top have ID '5' above '3' in rank 2, and ID '9' above '1' for rank 8, then use:
=INDEX(SORTBY(A2:B11,A2:A11,-1;B2:B11,-1),SEQUENCE(10),{1,2})
I could see this being relevant if you have two identical payments "battle" for e.g. 1st or 10th place with one of multiple id's comming short.

Using VLOOKUP to match a user ID to a supervisor

As you could probably already guess, I am working on a report summary that displays the amount of time each agent has spent in different statuses such as 'Available', 'Unavailable', 'In a meeting', etc. that can easily be modified and doesn't rely on specific criteria, just the table rows & columns. For example, if someone was to switch teams or get a new supervisor, the data would be updated automatically when replacing the supervisor name.
The issue that I am having is when I try to use a VLOOKUP in my 'Report' sheet to match an agent's User ID to their supervisor in the 'Agent List' sheet, I am getting #N/A as my result.
This is the function that I have tried:
=VLOOKUP('Agent List'!C2, 'Agent List'!A:D, 4, FALSE)
As far as I know, I have met all the required arguments by stating where the data is stored by using 'Agent List'!, the look up value, the table array, which column to match it to, and whether I want an exact match or approximate match.
I have played around with the function for a while, and have looked at others posts, but was unable to resolve the issue on my own. Any help I can get with this would be great. Any suggestions on a better idea to achieve the same result are also welcome.
Thanks,
TNA
Agent List table example:
#N/A in a vlookup sense usually means the value was no found.
This is due the the data not being in the first column of reference.
Also are you trying to lookup the data from one sheet to another? The value you are looking up should be the first value in the formula. You appear to be looking up from the same table you are returning result from.
Instead you can try:
=VLOOKUP(OTHERSHEET C2, 'Agent List'!C:D, 2, FALSE)
OR
=INDEX('Agent List'!D:D,MATCH(C2,'Agent List'!C:C, 0),1)

Creating keys/unique values for rows

I couldn't find the answer here, probably because of a lack of understanding the terminology.
I have created a sheet with several classes, and want to assign a unique ID (starting at "1") to each cell in the "Genus_ID" column. It must restart at 1 every time it identifies that it belongs to a new Family or Subfamily. Basically how a relational database would be designed.
Here is a sample of my sheet:
The Genus_ID is counting upwards, but it should reset to "1" at every new Family OR Subfamily.
Also, in I3 it shouldn't say "Porifera", but it should iterate the previous value ("1").
So, like this:
I'm using the following formula right now, it's close, but nowhere near perfect yet:
=IF(COUNTIFS(A$2:H2,H2)=1,MAX(I$1:I1)+1,VLOOKUP(A2,A$1:I1,2,0))
Can anyone help me out?
Thanks a lot!
If FAMILY is column D and GENUS is column H, try this in I2 and copy down
=IF(D2<>D1,1,IF(H2=H1,I1,I1+1))
If SUBFAMILY is in column F try this
=IF(OR(D2<>D1,F2<>F1),1,IF(H2=H1,I1,I1+1))

Outputting text values

I am unsure Excel would be able to do this automatically. I hope it can but maybe not.
I am trying to work with another member of staff in a different building. I have created a table trying to identify where the flow of some of the work is coming from. I am looking to try and count the amount of instances of text within a column. The problem is that the text can be pretty dynamic. As an example:
Consultant
a
a
b
a
b
a
b
z
c
c
c
Is there a way I can get excel to count the instances of text within the column, then create a table with the totals of the counts in it with labels.
I looked at pivot tables and that didn't seem to want to play ball.
The simplest way to do this is using COUINTIF
=COUNTIF(A:A,"a")
Which will simply tell you how many times "a" appears in the Column A.
You could easily duplicate this for every letter of the alphabet. Then use a summary table to display the results.

Resources