LCM function
LCM returns the least common multiple, the smallest positive number that every input divides into evenly. For example, it tells you when two schedules repeating every 4 and 6 days line up.
Example
Read it as a sentence: find the smallest whole number that both 4 and 6 divide into evenly, which gives 12.
A
B
C
D
1
12
2
3
Syntax
LCM(number1, [number2], ...)
Arguments in [square brackets] are optional.
-
number1(required) - The first whole number.
-
[number2], ...(optional) - More whole numbers, up to 255.
Returns: The smallest positive number that every input divides into evenly.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=LCM(12,18) | 36 | 12,18 |
=LCM(7) | 7 | Single 7 |
=LCM(0,5) | 0 | With 0 |
=LCM(0,0) | 0 | All zero |
=LCM(12.9,18.2) | 36 | Non-integer truncates |
=LCM({4,6,8}) | 24 | Array constant |
=LCM(-4,6) | #NUM! | Negative |
=LCM("a",18) | #VALUE! | Text arg |
Watch out for
- Decimals are truncated and negatives return #NUM!.
Where it works
- Excel
- LCM is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Math and trig functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .