Skip to content

Instantly share code, notes, and snippets.

@ncalm
Created May 27, 2024 16:19
Show Gist options
  • Save ncalm/9975a140f6afbae84b3336adc743a3e8 to your computer and use it in GitHub Desktop.
Save ncalm/9975a140f6afbae84b3336adc743a3e8 to your computer and use it in GitHub Desktop.
This Excel LAMBDA function taxes a table of incremental tax brackets and a known tax amount and calculates the income that would produce that tax amount.
GETSALARYFROMTAX = LAMBDA(low, high, rate,
LAMBDA(tax,
LET(
diff, high - low,
bracketmax, diff * rate,
runsum, SCAN(0, bracketmax, SUM),
XLOOKUP(
tax,
runsum,
low + diff * (tax - runsum + bracketmax) / bracketmax,
,
1 // Match or next largest item
)
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment