Excel duplicate

Hi, friend.
Help me.
how to remove duplicate names and dates.
as well as leaving max and min time on everyone?

is it possible to use delete duplicates or is there another logic that is more simple?
sample data and the desired output
image

image

1 Like

why are there still duplicate names in the second table?

thanks for you,
all I need is actually everyone’s arrival time and return time

1 Like

I wrote a sequence using what you provided… hope it helps!

  1. build new datatable
    image

  2. read input datatable (dt1)

  3. in dt1 add new data column called “combinedDateTime” that combines date and time columns into a DateTime variable

  4. assign list of unique names of dt1 to a list

  5. loop list of unique names

  • for each name, find max “combinedDateTime” in dt1, and add it to a new row
  • add new row to result table
  1. write result table to excel…

dt1.xlsx (10.4 KB) dt2.xlsx (8.6 KB) Sequence.xaml (15.4 KB)

When you remove duplicate values, the only effect is on the values in the range of cells or table. Other values outside the range of cells or table will not change or move. When duplicates are removed, the first occurrence of the value in the list is kept, but other identical values are deleted.

Because you are permanently deleting data, it’s a good idea to copy the original range of cells or table to another worksheet or workbook before removing duplicate values.

Follow these steps:

  1. Select the range of cells, or ensure that the active cell is in a table.

  2. On the Data tab, click Remove Duplicates (in the Data Tools group).

  3. Do one or more of the following:
    Under Columns, select one or more columns.
    To quickly select all columns, click Select All.
    To quickly clear all columns, click Unselect All.

  4. Click OK, and a message will appear to indicate how many duplicate values were removed, or how many unique values remain. Click OK to dismiss this message.

  5. Undo the change by click Undo (or pressing Ctrl+Z on the keyboard).

If the range of cells or table contains many columns and you want to only select a few columns, you may find it easier to click Unselect All, and then under Columns, select those columns.

Best,
Jerry M