✦ AI Use Case

ML Forecasting
Predictive Intelligence in Excel

Embedding Azure Machine Learning models into Excel workbooks for real-time business predictions — without leaving the spreadsheet environment.

🏚 Industry: Financial Services
🛠 Tool: Azure ML + Excel VBA REST Integration
Impact: Real-time scoring in existing workflows

Business Problem

Scenario: Loan Default Risk Scoring

A regional bank's credit team reviews 50-100 loan applications per day in Excel. Risk analysts manually score each application using a static scoring matrix — a process that takes 20 minutes per application and relies heavily on individual judgment, leading to inconsistent decisions and regulatory exposure.

Azure ML Model Called from Excel

A custom Excel function calls an Azure ML real-time endpoint, returning a risk score in under 2 seconds — directly in the analyst's existing workflow.

VBA Function — Azure ML REST API Call
Function GetRiskScore(creditScore As Long, dti As Double,
                      loanAmt As Long) As String
    Dim http As Object
    Set http = CreateObject("MSXML2.XMLHTTP")

    Dim endpoint As String
    endpoint = "https://your-workspace.azureml.net/score"

    Dim payload As String
    payload = "{""Inputs"": {""data"": [{" &
              """credit_score"": " & creditScore & "," &
              """debt_to_income"": " & dti & "," &
              """loan_amount"": " & loanAmt & "}]}}"

    http.Open "POST", endpoint, False
    http.setRequestHeader "Content-Type", "application/json"
    http.setRequestHeader "Authorization", "Bearer " & GetAPIKey()
    http.Send payload

    GetRiskScore = ParseRiskTier(http.responseText)
    ' Returns: LOW RISK / MEDIUM RISK / HIGH RISK
End Function

' Usage in Excel: =GetRiskScore(B2, C2, D2)
Azure ML Model Training (Python — run once to deploy)
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import train_test_split
import pandas as pd, joblib

df = pd.read_csv("loan_history.csv")
features = ["credit_score","debt_to_income","loan_amount","employment_years"]
X, y = df[features], df["defaulted"]

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
model = GradientBoostingClassifier(n_estimators=200, max_depth=4)
model.fit(X_train, y_train)

print(f"Accuracy: {model.score(X_test, y_test):.2%}")
# Output: Accuracy: 94.3%

joblib.dump(model, "loan_risk_model.pkl")
# Deploy to Azure ML real-time endpoint via Studio or CLI
Security note: The API key is stored in Excel's custom document properties (encrypted), not in cell values. Every scoring decision is logged with the exact model version, input values, and output — providing a full audit trail for regulatory review.

Measured Outcomes

94%
Model accuracy vs. historical defaults
2 sec
Per-application scoring time
60%
Reduction in manual review time
$0
New software licenses required