Excel file - Keep the most recent for each ID - excel

I have an excel file with this kind of data:
ID1 XXX YYY 22/11/1987
ID1 ZZZ AAA 23/11/1987
ID2 ZZZ AAA 23/11/1987
In that case, I would like to keep, for each ID (other fields might be differents), the most recent one, which would lead me with:
ID1 ZZZ AAA 23/11/1987
ID2 ZZZ AAA 23/11/1987
Thank you for your help

Assuming your data is in four columns (A:D) you might apply an array formula (CSE entry) such as:
=MAX(IF(A:A=A1,D:D))=D1
(although it would be preferable to restrict the number of rows to something manageable) in Row 1 and copied down to suit, to identify (by FALSE) rows to be deleted with Filter.

Related

Multiple Unique Lists from Master List in Excel

I have a list of companies with multiple contacts for each company, but I would like to create separate lists with 1 unique contact per company. E.g.
Original list
Name Company Email
John AAA john#aaa.com
David AAA david#aaa.com
Jane BBB jane#bbb.com
Julia CCC julia#ccc.com
Craigh CCC craig#ccc.com
John CCC john#ccc.com
In this case, to have 1 unique record from each company in a separate list, I want to end up with 3 separate lists:
List 1
Name Company Email
John AAA john#aaa.com
Jane BBB jane#bbb.com
Julia CCC julia#ccc.com
List 2
Name Company Email
David AAA david#aaa.com
Craigh CCC craig#ccc.com
List 3
Name Company Email
John CCC john#ccc.com
As you can see in each list there is only 1 record for each company.
Any help on how to do this would be most appreciated.
I have tried advance filter to list unique records only by selecting the entire original list as the range and setting the company column as the criteria see the unique records which I could then select visible cells and cut to a different list, and then re-run the filter again to create the next set of unique records etc...but the advance filter doesn't give the results as expected.
-
-
This might be a silly idea but still worth trying... Add a helper column with Count formula:
=COUNTIF($B$1:B2,B2)
Apply Filter and Sort your data set by the fourth column (Sort Smallest to Largest):
This seems to match your Table 1, 2 & 3 output.
Alternatively, if you still want to create separate tables, you can use the helper column and array formulas (Ctrl+Shift+Enter) as per example below:
=IFERROR(INDEX($A$1:$C$7,SMALL(IF($D$1:$D$7=1,ROW($D$1:$D$7)),ROW()-1),COLUMN()-5),"")
Change $D$1:$D$7=1 to =2 and =3 to replicate the 2nd and the 3rd table.
Edit: with additional "Location" column
=COUNTIFS($B$1:B2,B2,$D$1:D2,D2)

Can you normalize data with embedded sections in excel?

I was provided with some data in excel that I'm trying to transform to make it filterable. The data is in a specific order and looks like this:
Group ID RowType Name
1 Section Name1
1 Row AAA
1 Row BBB
1 Row CCC
1 Section Name2
1 Row DDD
1 Row EEE
2 Section ...
I want to take the name of the Row Type "Section" and transform it into a constant in it's own column. The final product would look like:
Group ID Section RowType Name
1 Name1 Row AAA
1 Name1 Row BBB
1 Name1 Row CCC
1 Name2 Row DDD
1 Name2 Row EEE
2 ...
I feel like this has probably be done but I haven't been able to put together the right terms to search... Any help would be appreciated.

Sum the value in one column based on the value in another column - excel 2013

I have 3 Columns, B,C and D.
Columns B,C,D will be updated periodically and the number of rows will be increased day by day.
Columns B contains NAME, C contains Quantity and D has Date value.
Name Qt Date
SSS 20
SSS 30
NNN 50
PPP 40 13-Jul-15
PPP 20 13-Jul-15
AAA 20
CCC 100
GGG 300
FFF 200
BBB 50 28-Aug-15
AAA 20
GGG 100
BBB 30
JJJ 50
BBB 30
FFF 50
FFF 25 24-Aug-15
CCC 75
JJJ 30
FFF 50
JJJ 36 24-Aug-15
FFF 50 24-Aug-15
I need the result as below.
Name Qt
AAA 40
BBB 30
CCC 175
FFF 300
GGG 400
JJJ 80
NNN 50
SSS 50
Rows with date field(column D) having a value should be omitted from adding.
Name field can contain any name and future names can vary from current names.
The Result can be in the same sheet or in the different sheet.
This may not meet your exact needs but it should get you the data you want in the first instance.
In Excel select the Insert tab and select Pivot Table.
Set the table range to be A1 to C60000 (or whatever the max number of rows is)
Select New Worksheet and click OK.
Add the Name and Qt fields to the report. It should automatically sum Qt.
Add Date to the Filters. This should add a bar above the pivot table that says something like:
Date (All)
Click on (All) and select (blank), and that should exclude the rows with dates specified.
use helper cells next to the date range =isblank(d2) this will return TRUE in E2
put AAA in G6, in H6 put the following formula =SUMIFS(C:C,E:E,"TRUE",B:B,G6)
if there is trash data in the blank cells like random spaces and whatnot use =isblank(trim(d2))
i loooove pivot tables but sometimes they just make file sizes too big if using a bunch of them in a single workbook, i also get tired of refreshing them.

Excel - identify duplicates consisting of two columns, in changing order

I am trying to identify the second duplicate combinations of cells across two (or more) columns. Complicating matters, the order of combinations varies.
To illustrate - my data looks something like this:
aaa 111
222 aaa
111 aaa
111 bbb
bbb 111
I'm looking for a formula that for this example would tell me that rows 1, 2 and 4 are the first instances of the combined values, whereas rows 3 and 5 are the second instances.
If you don't mind adding another column to the sheet, you can create an "index" for each row, making sure you always list the columns in the same order. (You can always copy values and delete the intermediary column.)
For example the following formula:
=IF($A1<$B1,CONCATENATE($A1,"!",$B1),CONCATENATE($B1,"!",$A1))
Will create a unique identifier like the following, using a ! character for a delimiter:
aaa 111 111!aaa
222 aaa 222!aaa
111 aaa 111!aaa
111 bbb 111!bbb
bbb 111 111!bbb
Then it's just a matter of using COUNTIF, for example with the index in column C:
=COUNTIF($C$1:$C1,$C1)
This will produce the following sheet, the number being the ordinal 1-based count of how many times that pair has appeared.
aaa 111 111!aaa 1
222 aaa 222!aaa 1
111 aaa 111!aaa 2
111 bbb 111!bbb 1
bbb 111 111!bbb 2
Someone with more time on their hands can probably come up with an array formula to do the same thing in memory.

Excel charting data

I'm having a hell of a time doing this...I want the vertical axis to represent how many times an ID appears and the horizontal to be the ID. So in essence the bar represents how often that ID appears in the column.
Any tips?
EDIT: for clarity...I have Column A loaded with IDs - might be 100 or more. I want a bar chart to show me how many times the ID has appeared. Just like below but with a bar going up to the # of times it appeared. I thought this was simple but charts don't seem to work this way. The IDs are going to be different so I don't think countif will work for this as that only works if you have a certain string.
Column A
ID1
ID2
ID4
ID3
ID1
ID4
ID8
ID4
ID5
ID6
ID7
ID1
ID8
ID8
ID1
ID9
ID8
ID10
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |______________________________________________________________
ID1 ID2 ID3 ID4 ID5 ID6 ID7 ID8 ID9 ID10
A PivotChart will do this quickly. To create one do the following:
Add a header to the column for the PivotTable to use
Put the cursor somewhere in your range of data
Go to "Insert" in the ribbon
Select PivotTable
Click OK
Add the field to both Rows and Values
Select the "Analyze" tab in the ribbon
Select PivotChart
Click OK
If the values are showing "Sum of" instead of "Count of", then do the following:
Double click on the header "Sum of [field]"
Change the selection to Count
Click OK
A quick solution: In the following image, I first put the distinct ID's in Column B, then in C1 I entered =COUNTIF($A$1:$A$18,B1), copied it down, then selected columns B, C and inserted a column chart:
The various chart elements can be clicked on and e.g. column width adjusted.

Resources