Home

Averaging non-adjacent cells with earlier errors

%3CLINGO-SUB%20id%3D%22lingo-sub-479095%22%20slang%3D%22en-US%22%3EAveraging%20non-adjacent%20cells%20with%20earlier%20errors%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-479095%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20an%20Excel%20newbie%20and%20have%20been%20butting%20my%20head%20against%20the%20wall.%20Not%20sure%20where%20the%20problem%20is%2C%20so%20have%20attached%20the%20spreadsheet.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20explanation%20for%20the%20spreadsheet%20is%20below.%20My%20question%20is%20at%20the%20end.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20attached%20spreadsheet%20is%20to%20track%20health%20issues.%26nbsp%3B%20Most%20of%20the%20first%20cells%20for%20each%20type%20of%20item%2Fdata%20have%20the%20red%20triangle%20showing%20a%20comment%2C%20with%20the%20comment%20explaining%20what%20the%20cell%20is%20for.%20I've%20entered%20sample%20data%20numbers%20in%20some%20cases%20to%20make%20it%20more%20obvious%20what%20is%20happening.%20Below%20is%20my%20documentation%20for%20the%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(NOTE)%20Naismith%2FScarf%20is%20a%20method%20to%20take%20hills%20into%20account%20when%20comparing%20different%20walking%20route%20distances.%20It%20is%20just%20a%20fudge%20factor%20for%20the%20elevation%20change%2C%20based%20on%20observations%20by%20experienced%20hikers.%20It%20adds%20distance%20to%20the%20actual%20total%2C%20based%20on%20how%20much%20uphill%20walking%20there%20was.%20This%20creates%20an%20%22equivalent%20distance.%22%20The%20equivalent%20distance%20(in%20terms%20of%20effort%20expended)%20is%20what%20would%20be%20an%20equivalent%20distance%20that%20is%20flat%20(no%20hills).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESpreadsheet%20is%20designed%20to%20be%20able%20to%20enter%20data%20on%20some%20days%20and%20not%20on%20others%20and%20have%20calculations%20still%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EColumn%201%20serves%20as%20a%20legend%20or%20list%20of%20abbreviations.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20Row%201%2C%20(C1%2C%20H1%20etc)%20show%20the%20week%20number%2C%20starting%20with%20WEEK%20ZERO.%3C%2FP%3E%3CP%3E(E1%2CF1%2CG1)%20J1%2CK1%2CL1)%20etc%20are%20column%20titles.%20So%20E3-E9%20record%20morning%20resting%20pulse.%20F3-F9%20records%20Systolic%20Blood%20Pressure.%20G3-G9%20records%20Diastolic%20Blood%20pressure.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERow%202%20sets%20the%20calendar%20date%20for%20the%20week%20(date%20of%20Sunday%2C%20which%20starts%20the%20week).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERows%203-9%20are%20Sunday%20through%20Saturday%20for%20each%20week.%20There%20are%20then%20four%20columns%20per%20week.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERows%2010-17%20sum%20up%20or%20average%20the%20data%20for%20the%20week%20for%20the%20weigh%2C%20weight%20change%2C%20pulse%20and%20BP.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERows%2020-24%20record%20behaviors.%20eg%3A%3C%2FP%3E%3CP%3EIf%20I%20walk%2C%20D20%20records%20the%20distance.%20E20%20records%20the%20elevation%20change%20on%20the%20walk%20(from%20Google%20Earth).%20F20%20records%20the%20time.%20C20%20calculates%20the%20speed%20in%20mph.%20D21%20calculates%20the%20equivalent%20distance%20if%20it%20had%20been%20flat%20(no%20hills)%20using%20Naismith%2FScarf%20equivalence%20constant.%20C21%20then%20calculates%20the%20speed%20(mph)%20over%20the%20Scarf%20equivalent%20distance.%20This%20lets%20me%20see%20progress%20in%20speed%20and%20distance%20even%20when%20I%20change%20routes%20with%20different%20amounts%20of%20hills.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EE21%20records%20the%20duration%20of%20morning%20stiffness.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EF21%20records%20(1-10%20scale)%20the%20severity%20of%20stiffness.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EG21%20records%20the%20exercise%20intensity%20of%20the%20day%20before%20to%20show%20if%20there%20are%20correlations%20with%20E21%20and%20F21.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EC22%20is%20a%20comment%20section%20to%20record%20diet%20and%20types%20of%20exercise%20other%20than%20walking.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E************************%3C%2FP%3E%3CP%3EMY%20QUESTION%3C%2FP%3E%3CP%3EI%20want%20to%20put%20week%20averages%20in%20Rows%2042-43.%20Cells%20C47-51%20work%20fine.%20The%20problem%20is%20when%20I%20started%20on%20cell%20C44.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20wanted%20to%20be%20able%20to%20average%20the%20weekly%20values%20of%20walking%20speed%2C%20distance%2C%20equivalent%20speed%20and%20equivalent%20distance.%20C44%20is%20to%20average%20weekly%20walking%20speed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20average%20the%20weekly%20speed%20of%20walking%2C%20I%20want%20to%20average%20whatever%20walking%20I%20did%20that%20week.%20Since%20walking%20could%20take%20place%20any%20day%20of%20the%20week%2C%20for%20the%20first%20week%2C%20it%20would%20average%20any%20values%20in%20C21%2C%20C23%2C%20C26%2C%20C29%2C%20C32%2C%20C35%2C%20C38.%20The%20problem%20is%2C%20because%20not%20every%20day%20has%20entries%20for%20walking%2C%20many%20of%20those%20cells%20return%20a%20%22%23DIV%2F0!%22%20error.%20This%20means%20averaging%20doesn't%20work.%20I%20tried%20putting%20in%20%22%26lt%3B%26gt%3B0%22%20to%20exclude%20those%2C%20but%20apparently%20don't%20understand%20how%20that%20works.%20I%20am%20guessing%20it%20only%20excludes%20actual%20zero%20values%20and%20not%20the%20error%20messages%20as%20well.%20I%20also%20tried%20%22%26gt%3B0.%22%20Also%20tried%20AVERAGEIF%20(got%20%22Too%20many%20arguments.%22)%20and%20also%20got%20lost%20in%20trying%20to%20understand%20arrays.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20mind%20a%20%22%23DIV%2F0!%22%20error%20in%20rows%2022-40%20or%20in%20rows%2010-18%20for%20weeks%20not%20yet%20entered.%20Those%20are%20fine.%20But%20in%20rows%2043-46%20it%20will%20mean%20I%20don't%20get%20the%20averages%20for%20the%20week%2C%20which%20is%20what%20I%20want%20to%20be%20able%20to%20see%20trends.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20solution%20for%20this%20problem%3F%20If%20you%20can%20show%20me%20what%20it%20is%2C%20I%20can%20use%20it%20for%20the%20other%20averages%20(C43%2CC45%2CC46)%20as%20I%20know%20they%20are%20going%20to%20have%20the%20same%20problem%2C%20and%20then%20copy%20the%20whole%20section%20into%20following%20weeks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20figure%20this%20can't%20be%20the%20first%20time%20this%20problem%20has%20come%20up%2C%20so%20there%20is%20likely%20an%20easy%20(and%20well%20known)%20solution%20that%20may%20even%20be%20well%20known.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWould%20someone%20point%20it%20out%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EChuck%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-479095%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
chuck1801
Occasional Visitor

I'm an Excel newbie and have been butting my head against the wall. Not sure where the problem is, so have attached the spreadsheet. 

 

The explanation for the spreadsheet is below. My question is at the end.

 

The attached spreadsheet is to track health issues.  Most of the first cells for each type of item/data have the red triangle showing a comment, with the comment explaining what the cell is for. I've entered sample data numbers in some cases to make it more obvious what is happening. Below is my documentation for the spreadsheet.

 

(NOTE) Naismith/Scarf is a method to take hills into account when comparing different walking route distances. It is just a fudge factor for the elevation change, based on observations by experienced hikers. It adds distance to the actual total, based on how much uphill walking there was. This creates an "equivalent distance." The equivalent distance (in terms of effort expended) is what would be an equivalent distance that is flat (no hills).

 

Spreadsheet is designed to be able to enter data on some days and not on others and have calculations still work.

 

Column 1 serves as a legend or list of abbreviations.

 

In Row 1, (C1, H1 etc) show the week number, starting with WEEK ZERO.

(E1,F1,G1) J1,K1,L1) etc are column titles. So E3-E9 record morning resting pulse. F3-F9 records Systolic Blood Pressure. G3-G9 records Diastolic Blood pressure.

 

Row 2 sets the calendar date for the week (date of Sunday, which starts the week).

 

Rows 3-9 are Sunday through Saturday for each week. There are then four columns per week.

 

Rows 10-17 sum up or average the data for the week for the weigh, weight change, pulse and BP.

 

Rows 20-24 record behaviors. eg:

If I walk, D20 records the distance. E20 records the elevation change on the walk (from Google Earth). F20 records the time. C20 calculates the speed in mph. D21 calculates the equivalent distance if it had been flat (no hills) using Naismith/Scarf equivalence constant. C21 then calculates the speed (mph) over the Scarf equivalent distance. This lets me see progress in speed and distance even when I change routes with different amounts of hills.

 

E21 records the duration of morning stiffness.

 

F21 records (1-10 scale) the severity of stiffness.

 

G21 records the exercise intensity of the day before to show if there are correlations with E21 and F21.

 

C22 is a comment section to record diet and types of exercise other than walking.

 

************************

MY QUESTION

I want to put week averages in Rows 42-43. Cells C47-51 work fine. The problem is when I started on cell C44.

 

I wanted to be able to average the weekly values of walking speed, distance, equivalent speed and equivalent distance. C44 is to average weekly walking speed.

 

To average the weekly speed of walking, I want to average whatever walking I did that week. Since walking could take place any day of the week, for the first week, it would average any values in C21, C23, C26, C29, C32, C35, C38. The problem is, because not every day has entries for walking, many of those cells return a "#DIV/0!" error. This means averaging doesn't work. I tried putting in "<>0" to exclude those, but apparently don't understand how that works. I am guessing it only excludes actual zero values and not the error messages as well. I also tried ">0." Also tried AVERAGEIF (got "Too many arguments.") and also got lost in trying to understand arrays. 

 

I don't mind a "#DIV/0!" error in rows 22-40 or in rows 10-18 for weeks not yet entered. Those are fine. But in rows 43-46 it will mean I don't get the averages for the week, which is what I want to be able to see trends.

 

Is there a solution for this problem? If you can show me what it is, I can use it for the other averages (C43,C45,C46) as I know they are going to have the same problem, and then copy the whole section into following weeks.

 

I figure this can't be the first time this problem has come up, so there is likely an easy (and well known) solution that may even be well known.

 

Would someone point it out?

 

Thanks

 

Chuck

2 Replies
I suggest that you manually enter your desired results, with an explanation of how you arrived at each of those results. Thereafter, I will analyze such results and recommend the formulas you need for each of them. Most importantly, please modify the layout of your data by unmerging all data cells.

@chuck1801 

Wow! That must come close to an all-time record for a calculation-hostile data layout!

For me, using Names to identify meaningful data objects, coping with data arrays scattered every 5rd column and every 3rd row with non-related data interspersed is a challenge.

Even the traditional direct selection of data using mouse clicks hits issues because the columns are broken up by merged cells.

 

One comment I would offer is do not attempt to calculate the week average speed from daily averages (the process requires a weighted harmonic mean).  Instead, calculate the value you require from the total distance and time taken.

= SUM(Distance) / SUM(WalkTime) / 24

 

Similarly the equivalent speed, allowing for the presence of hills, would be

= SUM( Distance+7.92*Elevation/5280 ) / SUM(WalkTime) / 24

 

Collecting the terms for the named variables such as 'distance' is somewhat more painful,   For example 'Distance' itself refers to a relative column with LOOKUP used to select every third value

= LOOKUP(day, seq, Experiment!D$20:D$40)

 

More complicated formulas would be required to lookup number by week number as well as day but, in the main, I think relative formulas that repeat over weeks will do.

 

Related Conversations
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies
*Updated 9/3* Syncing in Microsoft Edge Preview Channels
Elliot Kirk in Articles on
201 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
2 Replies