[TABLE="width: 855"]
<tbody>[TR]
[TD="colspan: 8"]Hi
What I am trying to achieve is a code that will remove semi duplicate rows of data from the attached spread sheet table, (Table 1) and then leave me the results as in (Table 2)
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 5"]I am not sure whether I need to concatenate as part of the formula or not in order to get the objective to work.
ORIGINAL DATA TABLE 1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]First Name
[/TD]
[TD]Surname
[/TD]
[TD]Date Of Birth
[/TD]
[TD]Date Of Assessment
[/TD]
[TD]Gender
[/TD]
[TD]Smoker
[/TD]
[TD]Health
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dave
[/TD]
[TD]Smith
[/TD]
[TD]02/06/1977
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam
[/TD]
[TD]Jones
[/TD]
[TD]03/03/1960
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam
[/TD]
[TD]Jones
[/TD]
[TD]03/03/1960
[/TD]
[TD]17-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rose
[/TD]
[TD]Frank
[/TD]
[TD]12/05/1981
[/TD]
[TD]14-May
[/TD]
[TD]Female
[/TD]
[TD]No
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Ben
[/TD]
[TD]Jakes
[/TD]
[TD]06/07/1988
[/TD]
[TD]16-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Bad
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Josh
[/TD]
[TD]West
[/TD]
[TD]12/02/1965
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rita
[/TD]
[TD]Copeman
[/TD]
[TD]25/06/1978
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rita
[/TD]
[TD]Copeman
[/TD]
[TD]25/06/1978
[/TD]
[TD]22-May
[/TD]
[TD]Male
[/TD]
[TD]Unknown
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Shariq
[/TD]
[TD]Najeeb
[/TD]
[TD]04/11/1976
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]Columns (A,B and C) are the columns I want to check for duplicates, theColumn (F) will be the only real variable I am concerned with.
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]So in the example we can see that "Adam" and "Rita" each have a duplicate entry, however there they have differing values in column F which is what I am concerned with and they also have a differing value in column D which I am not concerned about.
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]What I want to do effectively, when a duplicate is listed is keep the first line that is entered and remove the duplicate line. However I also want the line that is remaining to have the following changes to the Smoker column.
[/TD]
[/TR]
[TR]
[TD="colspan: 8"]I want the smoker column to then state the word "ERROR", followed by the text that is in both smoker columns for the duplicate entries, so you will see in the second table this is how I want the results to appear
IDEAL OUTCOME TABLE 2
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]First Name
[/TD]
[TD]Surname
[/TD]
[TD]Date Of Birth
[/TD]
[TD]Date Of Assessment
[/TD]
[TD]Gender
[/TD]
[TD]Smoker
[/TD]
[TD]Health
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dave
[/TD]
[TD]Smith
[/TD]
[TD]02/06/1977
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam
[/TD]
[TD]Jones
[/TD]
[TD]03/03/1960
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]ERROR "Yes","No"
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rose
[/TD]
[TD]Frank
[/TD]
[TD]12/05/1981
[/TD]
[TD]14-May
[/TD]
[TD]Female
[/TD]
[TD]No
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Ben
[/TD]
[TD]Jakes
[/TD]
[TD]06/07/1988
[/TD]
[TD]16-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Bad
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Josh
[/TD]
[TD]West
[/TD]
[TD]12/02/1965
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rita
[/TD]
[TD]Copeman
[/TD]
[TD]25/06/1978
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]ERROR "Yes","Unknown"
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Shariq
[/TD]
[TD]Najeeb
[/TD]
[TD]04/11/1976
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]So you will see my original table has reduced from 9 lines to 7
You will note for "Adam" there is now only one entry, colum (D) is using the date from the first entry in the original table, and then in column F is contains the text "ERROR" followed by the 2 duplicate entries from the previous table which were "Yes" and "No"
[/TD]
[/TR]
[TR]
[TD="colspan: 8"]You will note for "Rita" there is now only one entry, colum (D) is using the date from the first entry in the original table, and then in column F is contains the text "ERROR" followed by the 2 duplicate entries from the previous table which were "No" and "Unknown"
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]My data table is a lot larger than the sample but hopefully this is possible? I am happy to get the data I want in table 2 to open on a separate tab on my spreadsheet if that is an easier approach?
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Thank you in advance
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
<tbody>[TR]
[TD="colspan: 8"]Hi
What I am trying to achieve is a code that will remove semi duplicate rows of data from the attached spread sheet table, (Table 1) and then leave me the results as in (Table 2)
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 5"]I am not sure whether I need to concatenate as part of the formula or not in order to get the objective to work.
ORIGINAL DATA TABLE 1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]First Name
[/TD]
[TD]Surname
[/TD]
[TD]Date Of Birth
[/TD]
[TD]Date Of Assessment
[/TD]
[TD]Gender
[/TD]
[TD]Smoker
[/TD]
[TD]Health
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dave
[/TD]
[TD]Smith
[/TD]
[TD]02/06/1977
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam
[/TD]
[TD]Jones
[/TD]
[TD]03/03/1960
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam
[/TD]
[TD]Jones
[/TD]
[TD]03/03/1960
[/TD]
[TD]17-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rose
[/TD]
[TD]Frank
[/TD]
[TD]12/05/1981
[/TD]
[TD]14-May
[/TD]
[TD]Female
[/TD]
[TD]No
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Ben
[/TD]
[TD]Jakes
[/TD]
[TD]06/07/1988
[/TD]
[TD]16-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Bad
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Josh
[/TD]
[TD]West
[/TD]
[TD]12/02/1965
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rita
[/TD]
[TD]Copeman
[/TD]
[TD]25/06/1978
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rita
[/TD]
[TD]Copeman
[/TD]
[TD]25/06/1978
[/TD]
[TD]22-May
[/TD]
[TD]Male
[/TD]
[TD]Unknown
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Shariq
[/TD]
[TD]Najeeb
[/TD]
[TD]04/11/1976
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]Columns (A,B and C) are the columns I want to check for duplicates, theColumn (F) will be the only real variable I am concerned with.
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]So in the example we can see that "Adam" and "Rita" each have a duplicate entry, however there they have differing values in column F which is what I am concerned with and they also have a differing value in column D which I am not concerned about.
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]What I want to do effectively, when a duplicate is listed is keep the first line that is entered and remove the duplicate line. However I also want the line that is remaining to have the following changes to the Smoker column.
[/TD]
[/TR]
[TR]
[TD="colspan: 8"]I want the smoker column to then state the word "ERROR", followed by the text that is in both smoker columns for the duplicate entries, so you will see in the second table this is how I want the results to appear
IDEAL OUTCOME TABLE 2
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]First Name
[/TD]
[TD]Surname
[/TD]
[TD]Date Of Birth
[/TD]
[TD]Date Of Assessment
[/TD]
[TD]Gender
[/TD]
[TD]Smoker
[/TD]
[TD]Health
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dave
[/TD]
[TD]Smith
[/TD]
[TD]02/06/1977
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam
[/TD]
[TD]Jones
[/TD]
[TD]03/03/1960
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]ERROR "Yes","No"
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rose
[/TD]
[TD]Frank
[/TD]
[TD]12/05/1981
[/TD]
[TD]14-May
[/TD]
[TD]Female
[/TD]
[TD]No
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Ben
[/TD]
[TD]Jakes
[/TD]
[TD]06/07/1988
[/TD]
[TD]16-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Bad
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Josh
[/TD]
[TD]West
[/TD]
[TD]12/02/1965
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]No
[/TD]
[TD]Fair
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rita
[/TD]
[TD]Copeman
[/TD]
[TD]25/06/1978
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]ERROR "Yes","Unknown"
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Shariq
[/TD]
[TD]Najeeb
[/TD]
[TD]04/11/1976
[/TD]
[TD]14-May
[/TD]
[TD]Male
[/TD]
[TD]Yes
[/TD]
[TD]Good
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]So you will see my original table has reduced from 9 lines to 7
You will note for "Adam" there is now only one entry, colum (D) is using the date from the first entry in the original table, and then in column F is contains the text "ERROR" followed by the 2 duplicate entries from the previous table which were "Yes" and "No"
[/TD]
[/TR]
[TR]
[TD="colspan: 8"]You will note for "Rita" there is now only one entry, colum (D) is using the date from the first entry in the original table, and then in column F is contains the text "ERROR" followed by the 2 duplicate entries from the previous table which were "No" and "Unknown"
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 8"]My data table is a lot larger than the sample but hopefully this is possible? I am happy to get the data I want in table 2 to open on a separate tab on my spreadsheet if that is an easier approach?
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Thank you in advance
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Last edited: