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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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.
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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?
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,213,482
Messages
6,113,913
Members
448,532
Latest member
9Kimo3

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
Back
Top