Excel LAMBDA unit converter

A LAMBDA is a function you write in a cell. Microsoft 365 calculates it. There is no VBA and no add-in.

A pair of units

1 bar in psi. Put the bar value in cell A1 and multiply by this number. It is the same figure the converter shows. To convert any pressure unit, save the function from the pressure page.

=A1*14.50377377

A whole quantity

The function takes the unit you have and the unit you want. It looks up each unit's factor and, for temperature, its starting point. The result is the value times the first factor, plus any starting point, minus the second starting point, divided by the second factor. The LAMBDA library has one function per quantity. The names you type are this catalogue's abbreviations, including brackets, such as "Btu[IT]" and "kN/m2".

Excel allows 8,192 characters in a formula, and 126 pairs in SWITCH. The longest quantity here has 84 units, and each function fits.

Temperature needs a starting point

0 °C is 32 °F, so multiplying is not enough. This formula adds the difference between the two scales. Kelvin to Rankine uses the same formula, and both differences are zero.

=LAMBDA(value,LET(fromFactor,1,fromShift,273.15,toFactor,0.5555555555555556,toShift,255.3722222222222,(value*fromFactor+fromShift-toShift)/toFactor))(0)

How to save as a reusable Excel function

  1. Copy the LAMBDA from a quantity page or from the library. Do not include a call such as (1, "bar", "psi") at the end.
  2. On the Formulas tab, choose Name Manager, then New.
  3. Set Name to the function name, for example ConvertPressure. Leave Scope as Workbook.
  4. Paste the LAMBDA into Refers to.
  5. In a cell, type =ConvertPressure(1, "bar", "psi").

The quantity page shows the function on its own, and a sample call for the units you picked.

Google Sheets

Google Sheets has CONVERT and many of the same codes, and it has LAMBDA. Named functions are created under Data > Named functions, not Formulas > Name Manager. A code that works in Excel can return #N/A in Sheets, so try a known value before you rely on it.