Yavor Pchelata
Yavor Pchelata

Reputation: 13

How to import a field from MarketWatch in Google Sheets

I would like to scrape the EX-DIVIDEND DATE field from MarketWatch, where in my example the date is "Nov 15, 2018". This is the link:

https://www.marketwatch.com/investing/stock/inn.pd

Until now, I had used the following code:

=index(ImporthtML("https://www.marketwatch.com/investing/stock/inn.pd","list",14),13,1)

It worked just fine, but it seems something has got changed in MarketWatch and I am now unable to figure it out just by guessing different numbers in the query since I do not understand this language.

Can you provide me with a formula to scrape just this field? Thanks in advance!

Upvotes: 0

Views: 2340

Answers (2)

pnuts
pnuts

Reputation: 59495

'True' date option (ie Number format, not Text):

=1*mid(index(ImporthtML("https://www.marketwatch.com/investing/stock/inn.pd","list",23),13,0),18,50)

The information you seek was effectively moved from ColumnN to ColumnX (10 lists/columns inserted before it), hence 14 > 24, but remained in the same 'row' (13).

If much the same were to happen again a little trial and error should be all that is required for you to track down again the information you seek.

Upvotes: 0

player0
player0

Reputation: 1

=REGEXREPLACE(INDEX(IMPORTHTML(
 "https://www.marketwatch.com/investing/stock/inn.pd", 
 "list", 23), 13, 1),
 "Ex-Dividend Date", "")

Upvotes: 1

Related Questions