In Excel, go to Formulas > Name Manager > New. Enter MKT_CPA as the name, paste the full LAMBDA into Refers to, and save. Use =MKT_CPA(A2,B2) for one row, =MKT_CPA(A2:A20,B2:B20) for a traditional range, =MKT_CPA(A2:.A600,B2:.B600) for trailing Trim References, =MKT_CPA(A2#,B2#) for spilled ranges, and =MKT_CPA(A2:.A600,B2:.B600,1) for numeric output.
Marketing
MKT_CPA
Calculate CPA in Excel
Calculate cost per acquisition or conversion from spend and conversions in Excel.
=MKT_CPA(SPEND, CONVERSIONS, [NUMERIC])What It Does
What this function calculates
MKT_CPA calculates acquisition cost for campaign rows, channel summaries, and reporting models. It keeps CPA logic reusable, supports dynamic-array workflows, and lets you choose between formatted dollar output and numeric output.
Syntax
Function syntax
=MKT_CPA(SPEND, CONVERSIONS, [NUMERIC])Interactive Demo
Try MKT_CPA
Edit the spend or conversions below to see how MKT_CPA recalculates the result.
Arguments
Inputs this function expects
| Argument | Required | Description | Example |
|---|---|---|---|
SPEND | Required | The spend associated with the acquisitions, leads, purchases, or conversions. Can be a direct numeric value, compatible numeric text, single-cell reference, traditional range, named range, trailing Trim Reference, or Microsoft 365 spilled range. | 600 |
CONVERSIONS | Required | The number of conversions, acquisitions, leads, purchases, or completed actions. Can be a direct numeric value, compatible numeric text, single-cell reference, traditional range, named range, trailing Trim Reference, or Microsoft 365 spilled range. | 24 |
NUMERIC | Optional | Optional. Leave blank for presentation-ready text output. Enter 1 to return a numeric value suitable for calculations. The formula checks whether NUMERIC is supplied with ISOMITTED(NUMERIC), not whether the value specifically equals 1. | 1 |
Example
Example calculation
Expected result$25
Spend divided by conversions. Use formatted mode for presentation and numeric mode for blended CPA, forecasting, or additional modeling.
Sample Data
Copy/paste-ready sample data
Sample Campaign Data
Copy and paste this campaign dataset into Excel starting at A1, then test the function against the metric columns.
| Spend | Conversions | Campaign |
|---|---|---|
| 250 | 10 | Search Brand |
| 420 | 14 | Paid Social |
| 180 | 3 | Display Prospecting |
| 600 | 24 | Video Awareness |
| 90 | 0 | No Conversion Check |
=MKT_CPA(A2:.A600,B2:.B600)Expected outputWith the sample data pasted at A1, the formula spills formatted text results: $25, $30, $60, $25, and $90. Add ,1 for numeric CPA values. The zero-conversion row uses 1 as the denominator and should be reviewed.
Works with direct values, A2:B6-style ranges, Trim References through row 600, named ranges, and spilled ranges such as A2# and B2#.
Result
What the output means
Returns CPA as formatted dollar text by default, or a numeric value when NUMERIC is supplied. If inputs are aligned ranges or arrays, the function spills one CPA per row. Zero conversions are replaced with 1 before division, so no-conversion rows should be reviewed separately.
Function Definition
LAMBDA definition
=LAMBDA(SPEND,CONVERSIONS,[NUMERIC],IF(ISOMITTED(NUMERIC),
"$"&ROUND(IFERROR(VALUE(SPEND),"")/IFERROR(VALUE(IF(CONVERSIONS=0,1,CONVERSIONS)),""),2),
ROUND(IFERROR(VALUE(SPEND),"")/IFERROR(VALUE(IF(CONVERSIONS=0,1,CONVERSIONS)),""),2)))Installation
Add this function to Excel
Troubleshooting
Common errors
#SPILL! means Excel cannot place the dynamic-array result; clear blocked cells below or beside the formula. #NAME? usually means the function was not saved in Name Manager or the name was typed differently. Numbers stored as text are generally handled with VALUE(), but non-numeric labels, extra symbols, or incompatible text can still return blanks or unexpected results. If ranges are mismatched, align the numerator and denominator ranges before using dynamic arrays. When the denominator is zero, this function substitutes 1 before division to avoid divide-by-zero errors; that can create unusually large or non-standard results and should be reviewed. Omit NUMERIC for formatted text output; enter 1 for numeric output. Because the formula uses ISOMITTED(NUMERIC), any supplied third argument triggers numeric mode.
Custom Function Request
Need a function that isn't here?
Tell me what you're trying to calculate.