Having trouble with Average Formula

Robert Wyatt

Board Regular
Joined
Jul 15, 2012
Messages
102
Office Version
  1. 2019
Platform
  1. Windows
I'm having trouble getting my average formula to work could some one please help me figure out what I'm doing wrong?
Sleep Record.xlsm
BCDE
1Average Hours Slept Record
2
32 hrs 13 min
4Total Average Hours Slept
5
6DateBedtimeSleep End TimeHours Slept
7Monday April 10, 202306:31 PM02:48 AM7 hrs 26 min
8Tuesday April 11, 202308:30 AM10:00 PM#################
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
Sheet1
Cell Formulas
RangeFormula
E3E3=IF(D7="","",AVERAGE(E7:E40))
E7:E40E7=IF(D7="","",AVERAGE(IF(D7<>C7,C7-D7)+IF(C7<>D7,C7-D7)))
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
you are averaging empty cells as well. Try using =AVERAGEIF(E7:E40,"<>0")
 
Upvote 0
That works for the Total Averager part, but not for E8. it's the E7:E40 I'm having trouble with. it shows alot of ####
 
Last edited:
Upvote 0
I suspect its because it goes from AM to PM. Might need someone else to help on that.
 
Upvote 0
How about
Excel Formula:
=IF(D7="","",IF(C7>D7,D7-C7+1,D7-C7))
 
Upvote 0
Solution
That works just fine thanks for the help. I have been working for the last week on trying to get it to work.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,124
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top