Delete all Rows of data that do not contain currency and a certain term

torchD

New Member
Joined
Feb 20, 2015
Messages
9
Hey guys! First time posting here, hoping to hear some ideas from bright people such as yourselves
smile.gif
. I myself am pretty much a rookie when it comes to VBA's but I have played around with macros quite a bit. Anyways I work for a card store and a lot of our sales come from online. We like to keep our card's prices as updated as possible, this involves going to Amazon, looking each card's price up individually and updating it accordingly. This takes quite a lot of time and would be much easier if we could simply look at one spread sheet that contains all the updated prices. So I figured I should I'd play around in excel to see if I could come up with a way to accomplish this.

I have a macro set up that reads the data from the web into excel. Here is an example of a web page I pull data from:Amazon.com: Buying Choices: Pokemon Black & White Single Card Pikachu #115 Secret Rare
The problem is that a lot of junk comes along with the actual numbers I need. I have a spreadsheet to illustrate this. Basically I need to find a VBA code that deletes every row that does NOT have currency OR the term "total ratings" in it.

I've posted this on a few forums and received no help yet. If you want to download the sample spreadhseet you can find it on my post here: Cleaning up Data Scraped From the Web by Deleting Certain Rows

On my spreadsheet "sheet 1" is what the data looks like right after I pull it off the web and "sheet 2" is the end result that I am trying to achieve.

One of the things that make this problem very difficult for me is the fact that the data is going to change every time I pull it off the web because card prices are constantly changing and companies are listing cards cheaper than others at different times. It is not as simple as recording a macro that deletes rows:3-6 ,10-13 etc.


 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
not a member so cant get at it

do you need to check A1 and B1 and C1 for $£ or "total ratings" or is it all in one cell as a text file
 
Upvote 0
It is all in Column A of the spread sheet. It looks like this:

[TABLE="width: 174"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Amazon Try Prime
[/TD]
[/TR]
[TR]
[TD]Your Amazon.com Today's Deals Gift Cards Sell Help[/TD]
[/TR]
[TR]
[TD]Bosch Now Available[/TD]
[/TR]
[TR]
[TD]Shop by Department [/TD]
[/TR]
[TR]
[TD]Hello. Sign in Your Account Try Prime Wish List Cart 0 [/TD]
[/TR]
[TR]
[TD]<label alt="Bosch Now Available" id="nav-search-label" for="twotabsearchtextbox">Search </label>[/TD]
[/TR]
[TR]
[TD]All [/TD]
[/TR]
[TR]
[TD]Toys & Games[/TD]
[/TR]
[TR]
[TD]Best Sellers[/TD]
[/TR]
[TR]
[TD]New Releases[/TD]
[/TR]
[TR]
[TD]Preschool Toys[/TD]
[/TR]
[TR]
[TD]Boys' Toys[/TD]
[/TR]
[TR]
[TD]Girls' Toys[/TD]
[/TR]
[TR]
[TD]Games[/TD]
[/TR]
[TR]
[TD]Outdoor[/TD]
[/TR]
[TR]
[TD]Hobby, Models & Trains[/TD]
[/TR]
[TR]
[TD]Deals[/TD]
[/TR]
[TR]
[TD]Best Toys of the Month[/TD]
[/TR]
[TR]
[TD]Kids' Birthdays[/TD]
[/TR]
[TR]
[TD]******** name="site-search" role="search" accept-charset="utf-8" data-value="search-alias=aps" data-nav-digest="PLWobzU+yaSSYg7adOgLcoK0H9Y" data-nav-selected="0" data-category="toys-and-games" data-digest="M4DH6uNFd9BDpnH5/mmV19ocwqc" alt="" data-arid="370b55c7b422479ba0eeceac9aa08afd" id="DA4658i" src="about:blank" width="100%" height="55" frameborder="0" marginwidth="0" marginheight="0" scrolling="no">*********>
Return to product information
[/TD]
[/TR]
[TR]
[TD]New offers for
[/TD]
[/TR]
[TR]
[TD]Pokemon Black & White Single Card Pikachu #115 Secret Rare[/TD]
[/TR]
[TR]
[TD]by Pokemon Center[/TD]
[/TR]
[TR]
[TD]6 customer reviews [/TD]
[/TR]
[TR]
[TD]Compare:[/TD]
[/TR]
[TR]
[TD]Offers for this product[/TD]
[/TR]
[TR]
[TD]Offers for this product and similar products [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]‹ Return to product information Have one to sell? Every purchase on Amazon.com is protected by an A-to-z guarantee. Feedback on this page? Tell us what you think [/TD]
[/TR]
[TR]
[TD]All[/TD]
[/TR]
[TR]
[TD]New from $19.99 [/TD]
[/TR]
[TR]
[TD]Used [/TD]
[/TR]
[TR]
[TD]Show only: Free shipping Sorted by: Price + Shipping [/TD]
[/TR]
[TR]
[TD]Price + Shipping [/TD]
[/TR]
[TR]
[TD]Condition (Learn More)[/TD]
[/TR]
[TR]
[TD]Seller Information [/TD]
[/TR]
[TR]
[TD]Delivery [/TD]
[/TR]
[TR]
[TD]Buying Options [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]$21.96[/TD]
[/TR]
[TR]
[TD]+ $1.99 shipping [/TD]
[/TR]
[TR]
[TD]New[/TD]
[/TR]
[TR]
[TD]Card is in minty fresh condition. Lightning FAST shipping!![/TD]
[/TR]
[TR]
[TD]<no> Card is in minty fresh condition. Lightning FAST shipping!!</td> </tr> <tr height=20 style='height:15.0pt'> <td height=20 style='height:15.0pt'> </no> 95% positive over the past 12 months. (69,355 total ratings)[/TD]
[/TR]
[TR]
[TD]Ships from MO, United States. [/TD]
[/TR]
[TR]
[TD]Expedited shipping available. [/TD]
[/TR]
[TR]
[TD]International & domestic shipping rates and return policy. [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]Add to cart [/TD]
[/TR]
[TR]
[TD]or[/TD]
[/TR]
[TR]
[TD]Sign in to turn on 1-Click ordering.[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]$23.95[/TD]
[/TR]
[TR]
[TD]& FREE Shipping [/TD]
[/TR]
[TR]
[TD]New[/TD]
[/TR]
[TR]
[TD]97% positive over the past 12 months. (12,515 total ratings)[/TD]
[/TR]
[TR]
[TD]Expedited shipping available. [/TD]
[/TR]
[TR]
[TD]International & domestic shipping rates and return policy. [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]Add to cart [/TD]
[/TR]
[TR]
[TD]or[/TD]
[/TR]
[TR]
[TD]Sign in to turn on 1-Click ordering.[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]$19.99[/TD]
[/TR]
[TR]
[TD]+ $3.99 shipping [/TD]
[/TR]
[TR]
[TD]New[/TD]
[/TR]
[TR]
[TD]Brand New Mint Condition Shipped in Protective case at Collector's Cache![/TD]
[/TR]
[TR]
[TD]<no> Brand New Mint Condition Shipped in Protective case at Collector's Cache!</td> </tr> <tr height=20 style='height:15.0pt'> <td height=20 style='height:15.0pt'> </no> 97% positive over the past 12 months. (2,569 total ratings)[/TD]
[/TR]
[TR]
[TD]Ships from KS, United States. [/TD]
[/TR]
[TR]
[TD]Expedited shipping available. [/TD]
[/TR]
[TR]
[TD]Domestic shipping rates and return policy. [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]Add to cart [/TD]
[/TR]
[TR]
[TD]or[/TD]
[/TR]
[TR]
[TD]Sign in to turn on 1-Click ordering.[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]$29.95[/TD]
[/TR]
[TR]
[TD]& FREE Shipping [/TD]
[/TR]
[TR]
[TD]New[/TD]
[/TR]
[TR]
[TD]Brand New, Lightning Fast Shipping[/TD]
[/TR]
[TR]
[TD]<no> Brand New, Lightning Fast Shipping</td> </tr> <tr height=20 style='height:15.0pt'> <td height=20 style='height:15.0pt'> </no> 95% positive over the past 12 months. (7,075 total ratings)[/TD]
[/TR]
[TR]
[TD]Ships from CA, United States. [/TD]
[/TR]
[TR]
[TD]International & domestic shipping rates and return policy. [/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]Add to cart [/TD]
[/TR]
[TR]
[TD]or[/TD]
[/TR]
[TR]
[TD]Sign in to turn on 1-Click ordering.

[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Its very ugly I know, each line there represents a row in excel. I want to delete every row that does not have currency or the term "total ratings" in it. This is what I'm trying to achieve:

[TABLE="width: 585"]
<tbody>[TR]
[TD]Card Name[/TD]
[TD]Price[/TD]
[TD]Shipping[/TD]
[TD]Rating[/TD]
[/TR]
[TR]
[TD]Pokemon Black & White Single Card Pikachu #115 Secret Rare[/TD]
[TD="align: right"]21.96[/TD]
[TD="align: right"]1.99[/TD]
[TD="align: right"]69355[/TD]
[/TR]
[TR]
[TD]Pokemon Black & White Single Card Pikachu #115 Secret Rare[/TD]
[TD="align: right"]23.95[/TD]
[TD][/TD]
[TD="align: right"]12515[/TD]
[/TR]
[TR]
[TD]Pokemon Black & White Single Card Pikachu #115 Secret Rare[/TD]
[TD="align: right"]19.99[/TD]
[TD="align: right"]3.99[/TD]
[TD="align: right"]2569[/TD]
[/TR]
[TR]
[TD]Pokemon Black & White Single Card Pikachu #115 Secret Rare[/TD]
[TD="align: right"]29.95[/TD]
[TD][/TD]
[TD="align: right"]7075[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
not a member so cant get at it

do you need to check A1 and B1 and C1 for $£ or "total ratings" or is it all in one cell as a text file
 
Upvote 0
No I just need to check all the rows in Column A for $ or "total ratings" then delete all the rows that don't meet that criteria.
 
Upvote 0
Pokemon Black & White Single Card Pikachu #115 Secret Rare

how do you pull this line out as there is no currency or total ratings in it

otherwise I see what you want
 
Upvote 0
So I came up with a formula to check whether a cell contains a number or the term shipping in it. My currency values are formatted as plain numbers. This formula can weed out all the unnecessary information I am pulling off the web and will basically leave me with a column that has card prices, shipping prices and a whole lot of "#VALUE!" Here is the formula:

=IF(OR(ISNUMBER(A2),(SEARCH("shipping",A2))),A2,"")

It is working for the shipping part but for some reason it is not picking up the numbers so something must be messed up with my ISNUMBER statement. Any ideas?
 
Upvote 0
Pokemon Black & White Single Card Pikachu #115 Secret Rare

how do you pull this line out as there is no currency or total ratings in it

otherwise I see what you want
I am not worried about that part, I can manually type it in and record a macro to send the data to the right spot in my final table. The card name is always found on row 22 so it's not an issue. The problem with the prices and shipping is they are always in a different spot.

I have an update on the problem- the numbers are not actual currency $21.95 is reported as 21.95 so I can't simply search for all rows that contain a dollar sign. So i guess the problem turns into deleting all rows that do not contain a numeric value or the term "total ratings".
 
Last edited:
Upvote 0
=IF(OR(ISNUMBER(A2),(SEARCH("shipping",A2))),A2,"")

=if(or(a1=1,b1=1),do this,do that)

your formula only has one "or" term as search("shipping",A2) will return a number or an n/a
 
Upvote 0

Forum statistics

Threads
1,225,385
Messages
6,184,646
Members
453,250
Latest member
unluckyuser

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