Hello all,
I'm trying to achieve something fairly straightforward, but might be a bit tricky to explain. I've been using multiple table copies and vlookup to do this, but I'm hoping there is a faster way to go about it using a macro.
I will explain with a simple example:
I have a group of duplicate numbers in column A. In column B, I have names of fruits (three only for this simple example). Columns C to E correspond to whether a row has a specific fruit (called Has_Apple, Has_Mango and Has_Cherry respectively), and contains a value of 1 corresponding to the column that refers to the row having that fruit. So if a row in column B contains the string Apple, Has_Apple for that row will be 1, while the other two columns will be 0.
What is needed is to determine if a group/collection of duplicate numbers has 1s occurring for all three columns, and if so, collapse the group of duplicates. The value of the fruit in column B isn't important, but you can imagine it containing the names of all three fruits. The columns C to E will predictably contain all 1s only for that collapsed row representing the entire collection. If, however, 1s are NOT occurring for ALL THREE columns, then the entire group of duplicates should be discarded.
As I mentioned, I was using multiple tables and vlookups for this before, but I'm not sure how this is going to be doable by macro. I've attached the screenshots with the original dataset, and a results set which shows what the result of such a macro would look like. Version of Excel is 2016, from Microsoft Office Professional Plus 2016.
Thanks for any help!
I'm trying to achieve something fairly straightforward, but might be a bit tricky to explain. I've been using multiple table copies and vlookup to do this, but I'm hoping there is a faster way to go about it using a macro.
I will explain with a simple example:
I have a group of duplicate numbers in column A. In column B, I have names of fruits (three only for this simple example). Columns C to E correspond to whether a row has a specific fruit (called Has_Apple, Has_Mango and Has_Cherry respectively), and contains a value of 1 corresponding to the column that refers to the row having that fruit. So if a row in column B contains the string Apple, Has_Apple for that row will be 1, while the other two columns will be 0.
What is needed is to determine if a group/collection of duplicate numbers has 1s occurring for all three columns, and if so, collapse the group of duplicates. The value of the fruit in column B isn't important, but you can imagine it containing the names of all three fruits. The columns C to E will predictably contain all 1s only for that collapsed row representing the entire collection. If, however, 1s are NOT occurring for ALL THREE columns, then the entire group of duplicates should be discarded.
As I mentioned, I was using multiple tables and vlookups for this before, but I'm not sure how this is going to be doable by macro. I've attached the screenshots with the original dataset, and a results set which shows what the result of such a macro would look like. Version of Excel is 2016, from Microsoft Office Professional Plus 2016.
Thanks for any help!