The GCD function takes one or more arguments called number1, number2, number3, etc. All numeric values are expected to be integers. Numbers with decimal values will be truncated to integers before a result is calculated. Each argument can be a hardcoded constant, a cell reference, or a range that contains multiple values. The GCD function can accept up to 255 arguments total.

Examples

To return the greatest common divisor of the numbers 60 and 36: GCD returns the number 12, since 12 is the largest factor that goes into both numbers evenly. To get the greatest common divisor of 12, 16, 48: In the example workbook shown above, the formula in F5 is: As the formula is copied down, the GCD function returns a new result for each row, based on the values in columns B, C, and D. Empty cells are evaluated as zero.

Notes

GCD evaluates empty cells as zero. GCD works with integers; decimal values are removed before calculation. If arguments contain a non-numeric value. GCD returns the #VALUE! error. To calculate the least common multiple, see the LCM function.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.