LCM function
Returns the least common multiple of integers: the smallest number all of them divide into evenly.
Available in Excel 2007 and later (earlier with the Analysis ToolPak), Excel for the web, Excel for Mac
Excel 2007 and laterWorks in Google Sheets
Syntax
LCM(number1, [number2], ...)| Argument | What it means | |
|---|---|---|
number1 | Required | The first whole number (decimals truncated). |
number2, ... | Optional | Up to 255 values or ranges. |
Returns: The smallest positive integer that is a multiple of every value.
How LCM works
LCM finds when cycles line up again. Two buses leaving every 12 and 18 minutes depart together every 36 minutes; maintenance tasks every 4, 6 and 10 weeks coincide every 60 weeks. It also gives the smallest order that fills several pack sizes exactly.
Inputs must be zero or positive (negative values return #NUM!), and decimals are truncated. If any value is 0 the result is 0. The partner function GCD gives the greatest common divisor; for two numbers, LCM(a, b) × GCD(a, b) = a × b.
Examples
1When two bus lines depart together
| A | B | |
|---|---|---|
| 1 | Line | Every (min) |
| 2 | Line 10 | 12 |
| 3 | Line 24 | 18 |
| 4 | 36 |
Result: 36
Both leave together every 36 minutes.
2Smallest order that fills all pack sizes
| A | B | |
|---|---|---|
| 1 | Pack | Units |
| 2 | Small | 6 |
| 3 | Medium | 8 |
| 4 | Large | 10 |
| 5 | 120 |
Result: 120
120 units fill 20 small, 15 medium or 12 large packs with nothing left over.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | A negative value, or a result above 2^53. | Check the inputs. |
Tips
- Use LCM to find the repeat period of overlapping rotas or delivery schedules.
Google Sheets
LCM also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
LCM in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | MINDSTE.FÆLLES.MULTIPLUM |
| Dutch | KGV |
| Finnish | PIENIN.YHT.JAETTAVA |
| French | PPCM |
| German | KGV |
| Hungarian | LKT |
| Italian | MCM |
| Norwegian (Bokmål) | MFM |
| Polish | NAJMN.WSP.WIEL |
| Portuguese (Brazil) | MMC |
| Portuguese (Portugal) | MMC |
| Russian | НОК |
| Spanish | M.C.M |
| Swedish | MGM |
| Turkish | OKEK |