I have two column like this
column 1 column 2
abc ddd def ghij
abc ghi jkl dddd
bbc mno qrst wxyz
As you can see column 2 is having few letters from column 1. I need to sort column 2 based on the occurrence of this letters. So my column will be looking like
column 1 column 2
abc ddd def dddd
abc ghi jkl ghij
bbc mno qrst mnoq
How to sort this ?
With a couple of temporary helper columns, say:
in C1: =MID(A1,5,3)
in D1: =MATCH(LEFT(B1,3),C:C)
and both formulae copied down you might sort B:D in order ascending for ColumnD.
Related
Rat Rat 1 Rat 2
0 jkl No jkl
1 ghj No jkhj
2 mmm No jkl
3 klj No oo
4 kkk No jkk
I want to remove the column which has string 'No' and the output should have only rows Rat and Rat 2
If i have a dataframe and i want to merge ID column based on the Name column without deleting any row.
How would i do this?
Ex-
Name
ID
John
ABC
John
XYZ
Lucy
MNO
I want to convert the above dataframe into the below one
Name
ID
John
ABC, XYZ
John
ABC, XYZ
Lucy
MNO
Use GroupBy.transform with join:
df['ID'] = df.groupby('Name')['ID'].transform(', '.join)
print (df)
Name ID
0 John ABC, XYZ
1 John ABC, XYZ
2 Lucy MNO
I have a table as:
(Column A)Company Name | (Column B)Company Number
ABC | 123
ABC |
CBA |
CBA | 234
ACB | 567
ACB |
In Column B I need to insert data in row 2 as row 1 (or vice versa) because row 1 and 2 in Column A have same data. The table i have has about 6M such rows and hence looking for some help.
I think you need filters and then just paste the values you need.
I'm having a table looking like this:
id1 | id2 | dateUpdate
==========================================
aaa | 111 | 2016-01-01
aaa | 111 | 2016-01-02
aaa | 222 | 2016-01-05
aaa | 222 | 2016-01-15
bbb | 333 | 2016-01-05
bbb | 444 | 2016-01-01
ccc | 111 | 2016-01-02
I'd like to get only the latest row for each id1/id2 couple:
id1 | id2 | dateUpdate
==========================================
aaa | 111 | 2016-01-02
aaa | 222 | 2016-01-15
bbb | 333 | 2016-01-05
bbb | 444 | 2016-01-01
ccc | 111 | 2016-01-02
Thanks for your help!
Use Aggregate Function
=AGGREGATE(14, 6, 1/($A$2:$A$99=E2)*($B$2:$B$99=F2)*($C$2:$C$99), 1)
You have to put the unique combinations in column E2 and Column F2 downwards
You have five unique combinations
COLUMN A COLUMN B
aaa 111
aaa 222
bbb 333
bbb 444
ccc 111
And Aggregate Funtion is to be put in column G2 and fill down downwards.
=AGGREGATE(14, 6, 1/($A$2:$A$99=E2)*($B$2:$B$99=F2)*($C$2:$C$99), 1)
Regarding Syntax 14 is for Large value that is the for example larger for first aaa 111 combination that is #02-01-2016#
Next digit 6 in formula is for ignoring errors
You can quickly get the pseudo-Last value using the AGGREGATE function..
This is a standard non-array formula that does NOT require Ctrl+Shift+Enter. AGGREGATE was introduced with Excel 2010.
($A$2:$A$99=E2) checks which value of column A matches with the first unique value of column A of unique combination of A & B
This is converted to an array of logical values which gives an array of True Or False. Dividing 1 by these logical values give either 1 or DIV# error. Similar process is adopted for Column B values mentioned in column F. I have taken data limited to 99 rows. If it more number of rows you change the figure of 99 to a higher figure as per your requirements.
HTH
EDIT
You can also go for pivot table solution as suggested by #Tim Biegeleisen in his comments. Snapshot given here-under illustrates that approach.
id1 and id2 are taken as filter fields and Maximum Value of dateUpdate is chosen in the value field.
Hi guys and all Excel gurus, I am stuck with this one excel problem which I cannot solve. I tried using Index, Match, Vlookup but to no avail.
Basically I tried getting Column D displays Value from Column B if the Value of Column C contains part of the value in Column A.
So what I'm dealing with is something kind of like this:
Fixed the table display
+------------------------------------------------------+
| Header Column A Column B Column C Column D |
+------------------------------------------------------+
| Row 1 111 AAA 1111 |
| Row 2 222 BBB 112 |
| Row 3 333 CCC 2225 |
| Row 4 444 DDD 333 |
+------------------------------------------------------+
So my expected result would be:
+------------------------------------------------------+
| Header Column A Column B Column C Column D |
+------------------------------------------------------+
| Row 1 111 AAA 1111 AAA |
| Row 2 222 BBB 112 N/A |
| Row 3 333 CCC 2225 BBB |
| Row 4 444 DDD 333 CCC |
+------------------------------------------------------+
Sorry for the poor table display and explanation. Thanks Guys.
=INDEX($C$2:$C$5, MATCH(1,IF(ISERR(FIND($B$2:$B$5, $D2)),0,1),0))
, where 5 is the last data row. Enter as an array formula (Ctrl+Shift+Enter) in E2, then drag down.
BTW on row 4 it gives CCC, not N/A.