Math & trig function

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], ...)
ArgumentWhat it means
number1RequiredThe first whole number (decimals truncated).
number2, ...OptionalUp 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

B4fx=LCM(B2:B3)
AB
1LineEvery (min)
2Line 1012
3Line 2418
436

Result: 36

Both leave together every 36 minutes.

2Smallest order that fills all pack sizes

B5fx=LCM(B2:B4)
AB
1PackUnits
2Small6
3Medium8
4Large10
5120

Result: 120

120 units fill 20 small, 15 medium or 12 large packs with nothing left over.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 13 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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.

LanguageFunction name
DanishMINDSTE.FÆLLES.MULTIPLUM
DutchKGV
FinnishPIENIN.YHT.JAETTAVA
FrenchPPCM
GermanKGV
HungarianLKT
ItalianMCM
Norwegian (Bokmål)MFM
PolishNAJMN.WSP.WIEL
Portuguese (Brazil)MMC
Portuguese (Portugal)MMC
RussianНОК
SpanishM.C.M
SwedishMGM
TurkishOKEK