Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Need a little help with a custom function
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Longgamma, post: 7407839"] Hi, I need a function that scans a sheet for different identifiers and sum up the attributes of that variable within a specific date range ( fro today till a specified date). A sample list is below; DATE DIV RIC 9/19/2011 3.6 ABAN.NS 9/12/2012 3.6 ABAN.NS 9/19/2013 4 ABAN.NS 5/3/2010 2 ABB.NS 5/2/2011 2 ABB.NS 5/2/2012 3 ABB.NS 4/29/2013 3 ABB.NS 7/17/2012 10 ABBP.NS 7/1/2013 10 ABBP.NS 9/16/2010 4 ABGS.NS 9/15/2011 4 ABGS.NS 9/13/2012 4 ABGS.NS 9/17/2013 4 ABGS.NS 9/17/2014 4 ABGS.NS 9/17/2015 4 ABGS.NS For example, for for ABAN.NS stock, I need to sum up all values i column B whose dates fall between > today and a specified date. So if need all divs of ABAN.NS falling between today and 31-Dec-2012 thi year, it should give me 3.6 I am using this specific function but this is not working; Function dividends(ric As String, start_date As Date, end_date As Date As Long Dim i As Integer Dim temp As Integer dividends = 0 Sheets("Dividend").Activate i Sheets("Dividend").Range("A:A").Cells.SpecialCells(xlCellTypeConstants).Count For temp = 2 To i If Sheets("Dividend").Cells("F" & i) = ric An Sheets("Dividend").Range("B" & i).Value > startdate An Sheets("Dividend").Range("B" & i).Value <= enddate Then dividends = dividends + Sheets("Dividend").Range("C" & i).Value End If Next temp End Function The exact reference may not match as I have trimmed many columns in th data which are not necessary [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Need a little help with a custom function
Top