VBA function in Excel to return results from SQL Server 2012

Closed - This job posting has been filled and work has been completed.
Web, Mobile & Software Dev Other - Software Development Posted 2 years ago

Fixed Price

Budget: $200
Delivery by March 22, 2014

Start Date

February 8, 2014


The Function below allows a user to enter the following formula in MS Excel =ABB(A1,A2,A3,A4,A5). This formula will call the Function below which will lookup each variable in the desired Range and ultimately return the desired value. However, to make this work...the user has to import the source table from SQL Server into their local Excel workbook.

The job needed is to leave the source table in SQL Server 2012 and still write the formula in MS Excel =ABB(A1,A2,A3,A4,A5). Essentially the need is to take the data from SQL Server and feed into Excel based upon criteria outlined in the formula.  The solution needs to be provided in the form of a xlam.add-in.  The connection string to SQL Server is a variable that I will fill in.

Function ABB(dCat As String, dYear As Long, dTime As String, dScale As Variant, dBucket As Variant) As Double

Dim rng As Range
Dim rng1 As Range

Set rng = IIf(dTime = "QTR", Range("R_5"), Range("R_4"))
Set rng1 = IIf(IsNumeric(dBucket), Range("R_7"), Range("R_3"))
dScale = IIf(dTime = "YTD", "<=" & dScale, dScale)

ABB = Application.WorksheetFunction.SumIfs(Range("R_1"), Range("R_6"), dCat, Range("R_2"), dYear, rng, dScale, rng1, dBucket)

End Function

About the Client

(5.00) 4 reviews

United States
Coral Springs 06:54 PM

7 Jobs Posted
58% Hire Rate, 1 Open Job

$216 Total Spent
4 Hires, 0 Active

$22.22/hr Avg Hourly Rate Paid
3 Hours

Member Since Aug 9, 2012