Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following data in Columns A and B. I would like to write code for
all rows in columns A and B that: delete the rows for Example1 since the values in Column B are the same delete the row for Example 2 since it only has one value keep the rows for Example 3 since the values in Column B are NOT unique delete the rows for Example 4 since the value in Column B are the same Column A ColumnB Example1 Create PO Example1 Create PO Example1 Create PO Example2 Create PO Example3 Approve Invoices Example3 Approve Invoices Example3 Create PO Example4 Approve Invoices Example4 Approve Invoices Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One possible implementation would be to do as follows:
(It assumes that you've sorted by Column A) 1) Start at the last row, and find all the rows that have the same value in Col A. 2) Iterate through each of those rows in Col B to determine if they have only one type of value, or multiple types. (Do this by comparing all values against the the value in Col B in the last row... if any are different, you keep) 3) If any were different from step 2, delete all the rows that correspond to that section. 4) Repeat 1-3, starting one row before the first row from the previous section. ie. For your example, last row is row 10. Rows 9-10 have the same value in Col A. Go through values in Col B, find they are the same. Delete rows 9-10. Repeat starting in row 8 (9 - 1). Scott ALATL wrote: I have the following data in Columns A and B. I would like to write code for all rows in columns A and B that: delete the rows for Example1 since the values in Column B are the same delete the row for Example 2 since it only has one value keep the rows for Example 3 since the values in Column B are NOT unique delete the rows for Example 4 since the value in Column B are the same Column A ColumnB Example1 Create PO Example1 Create PO Example1 Create PO Example2 Create PO Example3 Approve Invoices Example3 Approve Invoices Example3 Create PO Example4 Approve Invoices Example4 Approve Invoices Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete Rows Where Value in Column V is Less than 2.5? | Excel Programming | |||
Delete rows with nothing in Column B | Excel Programming | |||
delete rows if value in column D is repeated | Excel Programming | |||
Delete all rows where Column A contains Text | Excel Worksheet Functions | |||
Delete All Rows That Column A value is not in Column A of Sheet2 | Excel Programming |