Excel Lunar Calendar Formula: Convert Dates to Moon Phases

Formulas & functions · Updated December 2, 2026

Excel has no built-in lunar-calendar or Moon-phase formula. For a simple phase estimate, enter a Gregorian date in A2 and use =MOD(A2-DATE(2000,1,6),29.530588853)/29.530588853; the result is the Moon’s approximate position in its 29.53-day cycle, from 0 to just under 1. This is an estimate, not an official lunar date or a precise astronomical calculation.

What an Excel lunar calendar can mean

“Lunar calendar” can refer to more than one thing. A phase calendar shows the progression from new Moon through first quarter, full Moon, and last quarter. A lunar-date calendar assigns numbered days and months according to a particular calendar system, such as the Islamic Hijri calendar or the Hebrew calendar. These are different tasks: a phase estimate does not convert a Gregorian date into a religious or cultural calendar date.

The formula above uses a familiar reference new Moon and an average synodic month, the interval from one new Moon to the next. The cycle is not exactly the same length every time, so a result calculated this way can drift from the observed phase. It is useful for a personal planner or a rough visual calendar, but not for determining dates that must follow an official calendar authority.

Build a simple phase label

Put Gregorian dates in A2:A32, one per row. In B2, calculate the cycle fraction with the formula in the opening paragraph, then fill it down. Format column B as Percentage if you want to see the cycle position numerically. A value near 0% is near the reference new Moon; around 50% is near full Moon.

To display an approximate phase name instead, with the date in A2, enter this formula in B2 and fill it down:

=CHOOSE(1+ROUND(MOD(A2-DATE(2000,1,6),29.530588853)/29.530588853*8,0),"New Moon","Waxing Crescent","First Quarter","Waxing Gibbous","Full Moon","Waning Gibbous","Last Quarter","Waning Crescent","New Moon")

The formula divides the cycle into eight broad sections. For example, a date whose cycle fraction is close to one-quarter is labeled First Quarter, and one near one-half is Full Moon. These labels are approximations: actual phase boundaries do not occur at perfectly equal eighths of the average cycle. The repeated New Moon at the end handles values rounded up to the next cycle.

Understand the reference date and calculation

Excel stores dates as serial numbers, so subtracting a reference date from a cell containing a valid Excel date gives the number of days between them. DATE(2000,1,6) supplies the reference date used in this estimate. MOD returns the remainder after dividing elapsed days by the cycle length, effectively wrapping the calculation back to the beginning of a new cycle. Dividing by 29.530588853 turns that remainder into a fraction between 0 and 1.

The reference date is a practical anchor, not a claim that the Moon was exactly new at midnight in every time zone. The phase formula also ignores the exact time of day. A date-only spreadsheet cannot distinguish a phase occurring just before midnight from one occurring just after midnight. If your use requires precise local phase times, consult a trusted astronomical almanac or data service rather than relying on this approximation.

Make the calendar easier to read

A basic sheet can use three columns: date, phase label, and cycle fraction. Enter the first date in A2 and subsequent dates below it. If you want Excel to create a sequence of dates automatically, put a starting date in A2, then enter a formula in A3 that adds one day to the preceding cell and copy it down. In Microsoft 365, you can also generate a date sequence with dynamic-array functions, but a simple fill-down approach works in older desktop versions too.

  • Format the date column with a clear date format, such as a full month name and day.
  • Use conditional formatting or a symbol column to make full and new Moon estimates easier to spot.
  • Keep the cycle fraction in a separate column so you can see how close a date is to the phase label’s midpoint.
  • Use a real date value, not text that merely looks like a date. If subtraction returns an error or an unexpected number, check the cell format and regional date interpretation.

For example, a fraction near 0.50 should be labeled Full Moon by the eight-part formula. A fraction near 0.25 should be close to First Quarter. Do not expect the label to match every published calendar exactly: different time zones, the approximate cycle length, and the formula’s broad phase bins can all produce a one-day or category difference.

Choose the right method for your purpose

Use the simple formula when you want an educational display, a rough gardening planner, or a general Moon-phase indicator. Use a reputable ephemeris or astronomy source when exact phase times matter. If you need a calendar conversion, first identify the calendar system and its rules, then use a dedicated, authoritative converter or a verified data source. There is no universal “lunar date” that Excel can infer from a Gregorian date.

Some lunar calendars are observational: the start of a month can depend on sighting the crescent Moon and on the authority or location making the determination. Others use calculated rules. Consequently, two calendars can assign different dates to the same civil date without either being a spreadsheet error. A fixed 29.530588853-day cycle cannot reproduce all of these rules.

Common errors and limitations

  • Getting a number instead of a phase: the first formula intentionally returns a decimal fraction. Use the CHOOSE formula for a text label.
  • Seeing #VALUE!: confirm that the date cell contains a real Excel date and not unrecognized text.
  • Unexpected labels: the categories are approximate bins. A date near a boundary may be labeled differently from a source using exact phase times.
  • Different results on another computer: regional date settings can interpret typed dates differently. Use Excel’s date picker or enter dates consistently, and avoid ambiguous text such as 04/05/2026.
  • Trying to get a Hijri or Hebrew date: phase position is not calendar conversion. Use a converter designed for the specific calendar, including its location or authority rules where applicable.

Microsoft 365 for Windows is the assumed version here, but the core functions DATE, MOD, ROUND, and CHOOSE are available in widely used desktop Excel versions. The same formulas can be entered in Excel for Mac and Excel for the web; menus and date-entry behavior may differ slightly, but the calculation does not depend on a Windows-only feature.

Frequently Asked Questions

Does Excel have a built-in Moon phase function?
No. Excel does not include a dedicated lunar-phase function. You can estimate cycle position with date arithmetic or import verified phase dates and times from an external source.

What is the formula for the Moon phase in Excel?
With a valid Gregorian date in A2, use =MOD(A2-DATE(2000,1,6),29.530588853)/29.530588853. It returns an approximate cycle fraction, not an official lunar calendar date.

Can Excel convert a date to a Hijri date?
Not with a standard built-in lunar-phase formula. Hijri dates may depend on a calculated method or crescent observation and local practice. Use a converter that explicitly identifies the method and authority.

Why does my result differ from a Moon calendar online?
The spreadsheet uses an average cycle and a reference date, while a published calendar may use exact astronomical times, a particular time zone, or observed crescent dates. Small differences are expected.

Can I use the formula for exact Moonrise or full Moon times?
No. It works with a date-level cycle estimate and does not calculate Moonrise, Moonset, or precise phase timestamps. Use an astronomical almanac or a reliable ephemeris for those details.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.