Related Article: What’s new in Numbers for iPhone and iPad

I've been keeping a sleep diary on a Numbers spreadsheet and I need help to get averages and trends.

I need information on how to create formulas for average duration of my sleep time expressed in hours and minutes, and to display my trends to micro sleep during the day. The runners log is the closest thing I've seen in the standard templates. I have not found a sleep diary template anywhere.

Mac mini, macOS 10.15

Posted on Aug 7, 2023 8:23 PM

Reply
4 replies

Aug 7, 2023 8:27 PM in response to Gallants2

Certainly, I can help you set up the necessary formulas in your Numbers spreadsheet to calculate the average duration of your sleep time and display trends related to micro sleep during the day.


Average Sleep Duration:


To calculate the average duration of your sleep time, which is expressed in hours and minutes, you can use the following steps:


1. Data Entry: Make sure you have columns for "Date," "Sleep Start Time," and "Sleep End Time" in your spreadsheet.


2. Calculate Sleep Duration: In a new column, let's say "Sleep Duration," you can use the formula to calculate the duration of sleep for each day. Assuming the sleep start time is in column B and the sleep end time is in column C, the formula in the "Sleep Duration" column (let's say it's column D) would be:

=(C2 - B2) * 24

This formula calculates the time difference between the sleep end time and start time and then multiplies it by 24 to convert the result to hours.


3. Calculate Average Sleep Duration:Once you have the sleep durations calculated, you can use the AVERAGE function to calculate the average sleep duration. Let's say you want to display the average sleep duration in another cell (let's say E2), the formula would be something like:

=AVERAGE(D2:D100)

Adjust the range (D2:D100) as needed based on where your sleep duration data is located.


Micro Sleep Trends:


If you want to track micro sleep during the day, you might not have direct data for that in your sleep diary. However, you could potentially track "awake" periods during the day and infer that micro sleep might be happening during those periods. You can follow these steps:


1. Data Entry: Create a column for "Date" and another for "Awake Periods" in your spreadsheet.


2. Track Awake Periods:In the "Awake Periods" column, manually record any instances where you suspect you had micro sleep or felt drowsy during the day. You can use numbers or descriptions to represent these periods.


3. Calculate Trends: You can use functions like COUNTIF or COUNTIFS to count the number of days you've marked as having micro sleep tendencies. For example, if you're using text labels like "Micro Sleep," and your "Awake Periods" column is in column B, you could use a formula like:

=COUNTIF(B2:B100, "Micro Sleep")

This formula counts the occurrences of "Micro Sleep" in the range B2:B100. Adjust the range as needed based on your data.


Remember that these trends are based on your observations and self-assessment, so the accuracy might vary. If you want more objective data on micro sleep, you might consider using devices like fitness trackers or specialized apps that track sleep patterns.

Aug 8, 2023 9:37 AM in response to Gallants2

Generic explanations may not work well here because Numbers handles dates and times differently from other spreadsheet software.


Here is a simple approach:



The formula in D2, filled down the column, is:


=MOD(C2−B2,"1d")


The bottom row is defined as a Footer Row. The formula in D7 is: =AVERAGE(D)


The MOD is helpful because a "time" entered in Numbers always has a date attached to it, even if you don't display it. If you don't supply a date then Numbers assumes the current date. That all can get confusing when sleep begins on one one day and ends on the next day, resulting in negative numbers. MOD prevents that.


Since you may have rows at the bottom where you have not yet entered Start and End times you could expand the formula in D2 to something like this and fill the down the column:


=IF(OR(ISBLANK(B2),ISBLANK(C2)),"",MOD(C2−B2,"1d"))




To see the trends try inserting a 2D Scatter Chart and adding connection lines in the Style tab.


SG

I've been keeping a sleep diary on a Numbers spreadsheet and I need help to get averages and trends.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.