Remove row set based on compare

projectile

Board Regular
Joined
Dec 14, 2007
Messages
193
Hello

I have this extract from msquery , and cannot find a way to exclude customers that have both to codes against their client record, SPQ & FUP for a particular date range. I cannot get the query to work, so think it best to return the figures to excel, and run a compare macro on the table.


Is it possible to do the following;

run a compare on the client column and activity column;;

If a client has has both a SPQ & FUP entry on different rows, then remove all instances of client row, then continue this down the sheet, so that all clients with both codes are removed.

e.g. if clients no. 003212 has both codes SPQ & FUP , then remove entire rows for 003212. i.e. in example below, 4 rows for INternational Ltd would be removed. In the example below, the entire rows in yellow should be removed, based on criteria above.


hope this makes sense.


activity.gif
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Dannyh1

Well-known Member
Joined
Nov 18, 2009
Messages
1,144
Hi,

Would this work:

D2 = B2&C2 (copy down)
E2 =IF(ISNA(IF(C2="SPQ",MATCH(B2&"FUP",D:D,0),IF(C2="FUP",MATCH(B2&"SPQ",D:D,0)))),"","delete") - copy down

Then filter on column E for "delete" & delete.
 

projectile

Board Regular
Joined
Dec 14, 2007
Messages
193
Is it possible to add another criteria to this formula , so that if a client has code SPQ and new code JOB, and regardless of FUP to mark for deletion?

Hope this makes sense.



Hi,

Would this work:

D2 = B2&C2 (copy down)
E2 =IF(ISNA(IF(C2="SPQ",MATCH(B2&"FUP",D:D,0),IF(C2="FUP",MATCH(B2&"SPQ",D:D,0)))),"","delete") - copy down

Then filter on column E for "delete" & delete.
 

Dannyh1

Well-known Member
Joined
Nov 18, 2009
Messages
1,144

ADVERTISEMENT

Hi,

Could you post another example table with new condition?

Cheers
 

projectile

Board Regular
Joined
Dec 14, 2007
Messages
193
activity2.gif


in this example , companies London Designs, Westfields, Northways should be removed (yellow area).


In essence the condition is something like this;


If a client has SPQ without a FUP and/or JOB then remove. or if client has FUP and/or JOB with no SPQ, then remove

hope this makes sense.

I tried to modify your formula but could figure out how to add the nested if else statement
 

projectile

Board Regular
Joined
Dec 14, 2007
Messages
193

ADVERTISEMENT

Can anyone help on this other condition?
 

Dannyh1

Well-known Member
Joined
Nov 18, 2009
Messages
1,144
sorry for mate - to be honest I was a bit stumped at 1st.

This looks horrible & someone can probably offer better option - maybe through code but this should work for now

=IF(ISNA(IF(ISNA(IF(C2="JOB","delete",IF(C2="SPQ",MATCH(B2&"FUP",D:D,0),IF(C2="FUP",MATCH(B2&"SPQ",D:D,0))))),IF(C2="SPQ",MATCH(B2&"JOB",D:D,0),IF(C2="FUP",MATCH(B2&"JOB",D:D,0))),IF(C2="JOB","delete",IF(C2="SPQ",MATCH(B2&"FUP",D:D,0),IF(C2="FUP",MATCH(B2&"SPQ",D:D,0)))))),"","delete")

Cheers.
 

projectile

Board Regular
Joined
Dec 14, 2007
Messages
193
Hi Danny.

Is doesn't appear to be marking clients with just FUP, appart from that the formula works.

Is it possible to get that added in?
 

Dannyh1

Well-known Member
Joined
Nov 18, 2009
Messages
1,144
Hi - don't no if I'm over complicating things here

Just to be clear - are the only items that should remain have only SPQ?
 

Watch MrExcel Video

Forum statistics

Threads
1,133,158
Messages
5,657,160
Members
418,363
Latest member
Debating_Earth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top