Example 1
LCM of two numbers
C2 =LCM(A2,B2)
Result: 12
12 is the smallest number that both 4 and 6 divide into exactly.
C2 =LCM(A2,B2) returns 12
Returns the least common multiple: the smallest positive whole number that all the numbers you give it divide into exactly.
Syntax
=LCM(, [number2], …)
All versions of Excel.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =LCM(A2,B2) returns 12
LCM finds the smallest number that every one of your inputs divides into with nothing left over. =LCM(4, 6) is 12, because 12 is the first number on both the 4 times table and the 6 times table.
The most practical use is finding when repeating schedules line up again. If one machine is serviced every 10 days, another every 15 and a third every 12, they all fall due on the same day every =LCM(10, 15, 12) = 60 days. The same method works for staff rotas, delivery rounds, payment cycles and any pattern that repeats.
To count how often the cycles coincide in a period, divide: =360/LCM(B2:B4) gives the number of times in a 360-day year when all three land together, as long as the result comes out whole.
To add fractions with different denominators, the lowest common denominator is the LCM of the denominators. =LCM(4, 6) is 12, so 1/4 + 1/6 is worked out in twelfths as 3/12 + 2/12.
LCM accepts up to 255 numbers or ranges: =LCM(B2:B4) and =LCM(10, 15, 12) both work. Putting a range in is the easiest way to include many values.
=LCM(4.9, 6) works on 4.#NUM!. Take ABS first.#VALUE!.The LCM of several large or co-prime numbers can be very big. Co-prime numbers have no common factor, so their LCM is their product. LCM(7, 11, 13) is 1,001. Check that a huge result is not a sign that the schedules never realistically align, and that you meant all of them to be included.
GCD is the companion function. For two numbers, =A2*B2/GCD(A2,B2) equals =LCM(A2,B2). Use GCD for splitting things into equal groups and LCM for finding when things repeat together.
PRODUCT multiplies the numbers, which gives a common multiple but usually not the least one. For 10, 15 and 12 the product is 1,800, 30 times too big.
B2:B4. Negative numbers return #NUM!.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =LCM(A2,B2)
Result: 12
12 is the smallest number that both 4 and 6 divide into exactly.
C2 =LCM(A2,B2) returns 12
Example 2
D2 =LCM(B2:B4)
Result: 60
After 60 days all three machines are due on the same day.
D2 =LCM(B2:B4) returns 60
Example 3
C2 =LCM(A2,B2)
Result: 35
7 and 5 share no factor, so the first time they meet is 7 x 5.
C2 =LCM(A2,B2) returns 35
Example 4
C2 =LCM(A2,B2)
Result: 0
If one of the numbers is 0 the result is 0. Check for blank cells in a range.
C2 =LCM(A2,B2) returns 0
Example 5
C2 =LCM(A2,B2)
Result: #NUM!
Wrap each argument in ABS if negatives can occur: LCM(ABS(A2), ABS(B2)).
C2 =LCM(A2,B2) returns #NUM!
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In D2, return the number of days after which all three machines are due for service on the same day.
Answer in D2.
#NUM!. Take ABS of each argument if signs can vary.#NUM!. Check the inputs are the cycles you mean.LCM(4.9, 6) works on 4. Use whole numbers.10*15*12 is 1,800, not 60.It returns the least common multiple: the smallest positive number that all your inputs divide into exactly. LCM(4, 6) is 12.
Use LCM on the cycle lengths. Services every 10, 15 and 12 days all fall on the same day every `=LCM(10,15,12)`, or 60 days.
Take the LCM of the denominators. For 1/4 and 1/6, `=LCM(4,6)` is 12, so both can be written in twelfths.
Yes. `=LCM(B2:B9)` uses every number in the range, up to 255 arguments in total.
For two numbers, LCM = A x B / GCD. For 12 and 18, the GCD is 6 and the LCM is 12 x 18 / 6 = 36.
Tracks take you from the basics to modelling, one graded exercise at a time.