How to insert column values for specific rows

yyl05

New Member
Joined
Apr 7, 2018
Messages
5
Hi everyone,

I currently have a csv file that consists of 600,000plus rows of data
I would like to insert value 'Malicious' into the column H, 'Class' for all rows of data that contains values 147.32.84.180 or 147.32.84.170 which appears in either column C or column D, and value 'Bakground' for all other values
Pictured below is an example of the first few rows which has column H filled, and I have a few hundred thousand more that I would like to fill up.


UtLIi9.jpg

I have tried using the filter function on both columns C and D each to filter out the rows containing the values, however it led to an error where its not displaying all values in the column. The error states that as there are more than 10,000 unique values, only the first 10,000 are displayed.


Any suggestions on how I can do this??
Thank you so much for your time
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Can you copy the column, and insert or paste it to the right of column H, then with ctrl-h replace 147.32.84.180 with malicious? Otherwise an If formula can do this.
 
Last edited:
Upvote 0
Try this
Code:
Sub MaliciousIP()
   With Range("H2", Range("G" & Rows.count).End(xlUp).Offset(, 1))
      .Value = Evaluate(Replace(Replace("if(@C="""","""",if((@C=""147.32.84.180"")+(@C=""147.32.84.170"")+(@D=""147.32.84.180"")+(@D=""147.32.84.170""),""Malicious"",""Backround""))", "@C", .Offset(, -5).Address), "@D", .Offset(, -4).Address))
   End With
End Sub
 
Upvote 0
Thanks everyone for your quick replies and suggestions, I managed to solve it using the IF formula
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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