Stock alerts in excel
In this post I will show you how excel can monitor stocks prices.
Table of contents
- Introduction
- Create stock quotes separated by comma (vba)
- Setup a web query to import stock prices from msn money
- Create stock alerts when a price is above/below criteria using conditional formatting
Introduction
In the sheet below are some random stock quotes (A6:A9) I will use to import prices. I have also created some random price alert ranges (C6:D9)
Create stock quotes separated by comma (vba)
To make the web query work I need to create a text string in cell E3 containing all stock quotes separated by comma. I can´t do that with the excel built in functions so I created this simple function ConcComma().
Option Explicit
Function ConcComma(Substrings As Range)
Dim CELL As Range
For Each CELL In Substrings.Cells
ConcComma = ConcComma & CELL.Value & ","
Next CELL
ConcComma = Left(ConcComma, Len(ConcComma) - 1)
End Function
How to Create Custom User Defined Excel Functions
Type in cell E3: ConcComma(A6:A9) + ENTER
Setup a web query to import stock prices from msn money
- Create a new Sheet "Web Query"
- Select A1
- Click "Data" tab.
- Click "From Web"
- In the address field type: http://moneycentral.msn.com/investor/external/excel/quotes.asp?SYMBOL=["QUOTE","Enter stock, fund or other MSN MoneyCentral Investor symbols separated by commas."]
- Click yellow arrow to select the table.
- Click Import
- Select where you want to place the imported table
- Click "Select cell" symbol
- Click Sheet "Alerts" and click cell E3.
- Enable "Use this value/reference for future refreshes"
- Click OK.
Create stock alerts when a price is above/below criteria using conditional formatting
- Sheet "Alerts" in cell E6, type: =INDEX('Web Query'!$D$4:$D$32;ROW(A1)) + Enter copied down to E9
- Select D6:D9
- Click "Home" tab
- Click "Conditonal formatting" on the ribbon
- Click "New Rule"
- Click "Use a formula to determine which cells to format"
- Type
=$D6<=$E6 in formula field
- Click "Format..."
- Click "Fill" tab
- Select a color
- Click OK!
Conditional formatting cells C6:C9
- Select C6:C9
- Click "Home" tab
- Click "Conditonal formatting" on the ribbon
- Click "New Rule"
- Click "Use a formula to determine which cells to format"
- Type
=$C6>=$E6 in formula field - Click "Format..."
- Click "Fill" tab
- Select a color
- Click OK!
Download excel sample file for this tutorial.
You need to enable macros.
Stock alerts_msn.xls
(Excel 97-2003 Workbook *.xls)
Related posts:
- Scan stock markets in excel
- Dynamic stock chart in excel – Add date ranges
- Create a dynamic stock chart using a web query and a drop down list in excel
- How to create excel macro to color every second row
- Create a dynamic border to your list using excel conditional formatting
- Color every second row using dynamic conditional formatting in excel
- Highlight duplicates using conditional formatting in excel
- Highlight dates within a date range using conditional formatting
- Highlight the second or more duplicates in two lists using conditional formatting in excel
- Highlight duplicates where adjacent cell value meets criteria using conditional formatting in excel







Leave a Reply