Excel sort by similar cell data - excel

So I have this list of data that i need to compare 2 spreadsheets with. Im going to simplify it with a list like below(Column A being a part number, and column B being a quantity):
Spreadsheet 1:
Red 1
Blue 2
Green 1
Orange 6
Yellow 8
Spreadsheet 2:
Red 1
Green 1
Blue 2
Orange 6
Yellow 8
Silver 2
Brown 3
Now what i would like my output to be:
Red 1
Blue 2
Green 1
Orange 6
Yellow 8
Silver 2
Brown 3
Notice that im sorting it so that list 2 aligns with list one, and if list 2 contains things that are not on list 1 it puts it at the bottom(preferably vice-versa compatible). Im not sure if this is even possible, but if it is it will GREATLY decrease my workload so any help is MUCH appreciated. Thanks for your time!

Related

add rows to dataframe after multiply by column value [duplicate]

This question already has an answer here:
Repeat Rows in Data Frame n Times [duplicate]
(1 answer)
Closed 5 months ago.
I have the following datafame:
count color name
2 blue mike
3 red james
1 orange mark
3 yellow oscar
I want to take the count value and insert as many rows as the count value. The output should be:
count color name
2 blue mike
2 blue mike
3 red james
3 red james
3 red james
1 orange mark
3 yellow oscar
3 yellow oscar
3 yellow oscar
I've tried to use the multiply function, but this is just multiplying the count column when I want to insert more rows. If someone could point me in the right direction, I would greatly appreciate it.
Try with reindex and repeat
df = df.reindex(df.index.repeat(df['count']))

Column order in PowerView

I have following sample data in PowerPivot:
id name type color
1 aaa x blue
2 bbb y red
3 ccc x blue
4 ddd y orange
5 eee z black
When I create pivot table in Excel and enable show details (doubleclick on specific value), I get follwing output:
[$Sheet1].[id] [$Sheet1].[name] [$Sheet1].[type] [$Sheet1].[color]
1 aaa x blue
2 bbb y red
3 ccc x blue
4 ddd y orange
5 eee z black
What I'd like to set is my own column order or specify columns which I want to see. E.g.:
[$Sheet1].[id] [$Sheet1].[color]
1 blue
2 red
3 blue
4 orange
5 black
Could you please advise? Thanks
You need to merge the sort table with the main table, so the sorting numbers are inside the main table. Then you can click the Colour column and set the sort order to the sort column using the "Sort by Column" command on the Home ribbon of the Power Pivot window. In the screenshot, I have added the desired sort numbers
1 - red
2 - blue
3 - black
4 - orange
and added the values in a new column. Then defined the Sort by Column and created a pivot table where the color data is in the rows. Note how the desired sort order is applied correctly.
There are many different ways how you can get the sort numbers into the helper sort column.

Concatenating INDEX/MATCH with multiple criteria and multiple matches

I am using Excel to track a team game where players are divided into teams and subteams within teams. Each player within a subteam scores a certain number of points, and I would like to have a summary string for each player with the number of points other players in the same subteam scored.
Example:
A B C D
PLAYER TEAM SUBTEAM POINTS
Alice Red 1 70
Bob Red 1 20
Charlie Red 1 10
Dave Red 2 70
Erin Red 2 30
Frank Blue 1 55
Grace Blue 1 45
My desired output looks like this:
A B C D E
PLAYER TEAM SUBTEAM POINTS SUMMARY
Alice Red 1 70 Bob:20, Charlie:10
Bob Red 1 20 Alice:70, Charlie:10
Charlie Red 1 10 Alice:70, Bob:20
Dave Red 2 70 Erin:30
Erin Red 2 30 Dave:70
Frank Blue 1 55 Grace:45
Grace Blue 1 45 Frank:55
The furthest I was able to go is a combination of CONCATENATE, INDEX, and MATCH in an array formula:
{=CONCATENATE(INDEX($A$2:$A$8,MATCH(1,(C2=$C$2:$C$8)*(B2=$B$2:$B$8),0)), ":", INDEX($D$2:$D$8,MATCH(1,(C2=$C$2:$C$8)*(B2=$B$2:$B$8),0)))}
This unfortunately just outputs a summary for the first player in the subteam:
A B C D E
PLAYER TEAM SUBTEAM POINTS SUMMARY
Alice Red 1 70 Alice:70
Bob Red 1 20 Alice:70
Charlie Red 1 10 Alice:70
Dave Red 2 70 Dave:70
Erin Red 2 30 Dave:70
Frank Blue 1 55 Grace:45
Grace Blue 1 45 Grace:45
What I need to do now is:
Excluding the player for the summary (I don't want Alice in the summary for Alice, but only Bob and Charlie)
Getting it to work for multiple matches (there can be an arbitrary number of players in each subteam)
Getting CONCATENATE to work with an unknown number of strings (because as said above, there can be an arbitrary number of players in each subteam).
Ideas appreciated!
I put together a helper column that concatenates each player/points and the TEXTJOINIFS from TEXTJOIN for xl2010/xl2013 with criteria for the desired results.
Unfortunately Excel (prior to Excel 2016) cannot conveniently join text. The best you can do (if you want to avoid VBA) is to use some helper cells and split this "Summary" into separate cells.
See example below. The array formula in cell E4 is dragged to cell J10.
= IFERROR(INDEX($A$4:$D$10,MATCH(SMALL(IF(($B$4:$B$10=$B4)*($C$4:$C$10=$C4)*($A$4:$A$10<>$A4),
ROW($A$4:$A$10)),E$3),ROW($A$4:$A$10),0),MATCH(E$2,$A$1:$D$1,0)),"")
Note this is an array formula, so you must press Ctrl+Shift+Enter instead of just Enter after typing this formula.
Of course, in this example I assume 3 players. Your requirement of arbitrary amount of players cannot be met with formulas alone, but you can just extend the "Summary" section over to the right as far as necessary.
If you really wanted to, you could even concatenate the "Summary" rows to form a single cell, e.g. something like:
= CONCATENATE(E4,": ",F4,", ",...)

Count duplicate values in a sequence

How can I count duplicate data in a column using excel?
Example
A B
apple 1
apple 2
apple 3
ball 1
bat 1
dog 1
dog 2
gole 1
gole 2
gole 3
gole 4
I think there is no uniform formula for all cells in your case.
I would suggest something like this:
Put this on B column and then fill down the rest.
=COUNTIF($A$1:$A1,$A1)
After you fill the other rows, values of rows would look like this
B1=COUNTIF($A$1:$A1,$A1)
B2=COUNTIF($A$1:$A2,$A2)
B3=COUNTIF($A$1:$A3,$A3)

Excel - get the highest number in a certain column, that contains text

I have these two sheets, that I'm using to keep track of my work. In one of the sheets, I have my overview, where I can see all of my tasks at hand. In other sheets, I have the different jobs I'm currently doing.
Now... I'm looking for at formula for Microsoft Excel, where I can do the following:
="GET THE HIGHEST ROW-NUMBER, IN A CERTAIN COLUMN, THAT ISN'T EMPTY, AND PUT THE TEXT FROM THAT COLUMN INTO ANOTHER CELL" (see examples of it further down)
Examples:
Let's say, that I insert this formula into D10, and to check the entire A-column, then this would be the result
Ex.1
A B C D
1 Foo
2 Bar
3 Is
4 An
5 Apple
6 From
7 Chile
8
9
10 Chile
Ex.2
A B C D
1 Foo
2 Bar
3 Is
4 An
5 Apple
6
7
8
9
10 Apple
Ex.3
A B C D
1 Foo
2 Bar
3 Is
4
5
6
7
8
9
10 Is
Ex.4
A B C D
1 Foo bar is
2 Also an
3 Egyptian God
4 Of pie
5
6
7
8
9
10 Of pie
On a last remark... Then I'm using this stupid danish version of Excel, so if you're a dane trying to solve this, then a danish formula would be 'B-E-A-UTIFUL'.
And remember, that it has to work across different sheets.
MY ATTEMPTS:
I Google around for about an hour... I found this, which I tried to understand:
=INDIRECT(CONCATENATE("R",MATCH(MAX(S4:S5),S4:S5,0)+3))
But I couldn't get it to work, because of this stupid danish Excel. I tried to understand it, then - and figured out, that it parsed and concatenated area as text and inserted that into the field - so I guess that wouldn't do the trick anyways.
Then my idea was to try to loop through all the cells in a column and check each of the cells, if they weren't empty, and if their row-number where higher than then previous. I quickly gave up on that one, because I couldn't find a way to make a for loop in Excel.
Then I've tried all other sorts of things (mainly experimenting with the MAX()-function).
If your data is in a sheet called data then try this formula to get the last text value in column A of that sheet
=LOOKUP(REPT("z";255);Data!A:A)
In Danish that should be
=SLĂ….OP(GENTAG("z";255);Data!A:A)

Resources