delete cell content based on criteria in another column

RinaHale

New Member
Joined
Jun 20, 2018
Messages
5
Hello!
I am making my very first macro so I am completely new at this
.
I need to delete the value DEB from column BY if the value of the cell in column AJ contains 14 somewhere in the alphanumeric value. That is all I need to do.

But my data base is huge (A to GW) and the number or rows varies and grows every month - as it stands now I have a little under 30K rows.

DEB is not unique in column BY; by which I mean values without 14 can have a DEB, but that is ok and needs to stay in the data base.

Can someone, please, help me? I am driving myself mad.
Thank you so much!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi & welcome to the board.
How about
Code:
Sub ClearDEB()
With Range("By2", Range("BY" & Rows.Count).End(xlUp))
   .Value = Evaluate(Replace(Replace("if((@=""DEB"")*(isnumber(find(""14"",@a))),"""",@)", "@a", .Offset(, -41).Address), "@", .Address))
End With

End Sub
 
Upvote 0
Hi Fluff,

Thank you for your reply.
I think your code replaces the DEB with blank, right?
I need the cell to be empty as I import the result in a system which considers blank as a value. It's over my head why blank would be considered a value, but...
Do you think it would be possible to clear the cell completely?

Thank you again!
 
Upvote 0
The code should be making the cell empty, if it's causing you problems try
Code:
Sub ClearDEB()
With Range("By2", Range("BY" & Rows.Count).End(xlUp))
   .Value = Evaluate(Replace(Replace("if((@=""DEB"")*(isnumber(find(""14"",@a))),"""",@)", "@a", .Offset(, -41).Address), "@", .Address))
   .Value = .Value
End With

End Sub
 
Upvote 0
Do you have any blank cells in that column?
 
Upvote 0
Hi Fluff,

The column does not have blank cells in it. But blank is an accepted value.

But. Good news. I used your second coding and it now gave me a blank cell. I have sent it to the system and am now waiting for the result. I hope for the best.

Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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