Revise!! Excel VBA Code question?

Javi

Active Member
Joined
May 26, 2011
Messages
440
I am totally failing at this one.

Column B has multiple duplicates, Column K has my 2nd criteria.

All matches in column B with only 0 in column K needs to be indicated in column 0 with a true or false or whatever anthing to sort by.

If a match single or group has a value other than 0 in column K it needs to be ignored or indicated with a different indicator so I may sort by.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
I would post what I have to this point however nothing is working.
 

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.
I am totally failing at this one.

Column B has multiple duplicates, Column K has my 2nd criteria.

All matches in column B with only 0 in column K needs to be indicated in column 0 with a true or false or whatever anthing to sort by.

If a match single or group has a value other than 0 in column K it needs to be ignored or indicated with a different indicator so I may sort by.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I would post what I have to this point however nothing is working.

Can you post a sample file using megaupload

Alternatively ,try using Excel jeanie, MrExcel HTML Maker or Borders-Copy-Paste to post your sample.

Biz
 
Upvote 0
Hi Javi,

You don't need a macro to do this, i.e. put this formula...

=IF(AND(COUNTIF($B$2:$B$40,B2)=1,K2=0),"Keep","Delete")

...into cell O2 and then fill down from O3 to O40.

HTH

Robert
 
Upvote 0
Sorry that was my error with the merge. The formula is very slow with 85K rows would vba work any better?
 
Upvote 0
The formula is very slow with 85K rows would vba work any better?

No. Macros are generally less efficient than native excel formulas.

Make sure you're not referencing entire columns and try converting the formulas to values (though this will mean you'll have to re-enter the formula when rows are added and/or the data changes).
 
Last edited:
Upvote 0
Thank you very much!! It just finished about 15 min total calcauation time. I will validate the data now.. Thanks again.
 
Upvote 0
Try code below. It creates formula and then paste special values.

Code:
Sub Test()
    Dim LR As Long
    LR = Range("A" & Rows.Count).End(xlUp).Row
    With Range("O2:O" & LR)
        .FormulaR1C1 = "=IF(AND(COUNTIF(R2C2:R40C2,RC[-13])=1,RC[-4]=0),""Keep"",""Delete"")"
        .Value = .Value
    End With
End Sub

Does this help?

Biz
 
Upvote 0
You're welcome. Now that Biz has provided a macro solution for the formula you have the best of both worlds :)
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,673
Members
452,937
Latest member
Bhg1984

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