Distributing an average across cells

rmedders88

New Member
Joined
Oct 26, 2017
Messages
3
[TABLE="width: 500"]
<tbody>[TR]
[TD]read[/TD]
[TD]Desired result[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]35[/TD]
[TD]35[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]65[/TD]
[TD]30[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]95[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I am not sure if this is possible, but I am trying to build a sheet that will spread a total across multiple cells if blank. In the example above column "A" represents an instrument reading that is taken generally 5d/wk and I need something to average in the days if not populated. I have a formula that totals from one read to the next if days are missing, but I can't solve how to build the distribution. Forgive if I use poor terms I am still relatively new to Excel. I can do this manually, but am trying to build something I can lock and that saves staff some time and doesn't allow them to accidentally erase formulas etc in the sheet.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Well, it ain't pretty and could probably be optimised, but the following worked for me. With the "read" heading in cell B2, and starting the formula in C3 and filling down:

=IFERROR(IF(AND(B2<>"",B3<>""),B3-B2,IF(AND(B3<>"",B2=""),C2,(MIN(IF((B:B)>LOOKUP(2,1/($B$3:B3<>""),$B$3:B3),B:B))-LOOKUP(2,1/($B$3:B3<>""),$B$3:B3))/(MATCH(MIN(IF((B:B)>LOOKUP(2,1/($B$3:B3<>""),$B$3:B3),B:B)),B:B,FALSE)-MATCH(LOOKUP(2,1/($B$3:B3<>""),$B$3:B3),B:B,0)))),B3)

Note: This is an array formula and you have to press CONTROL+SHIFT+ENTER for it to work.
 
Upvote 0
rmedders88, welcome to the Forum

Another way, assuming your first reading is in in cell A1:

B1: =A1
B2: =IF(A2="",B3,(A2-INDEX(A$1:A$5,MATCH(A2-0.00001,A$1:A$5,1)))/(ROW()-ROW(A$1)+1-MATCH(A2-0.00001,A$1:A$5,1))) Copy down

This will only work if:

- A1 always contains an opening value?
- Your instrument readings always increase, as in the example you've shown?
 
Upvote 0
Stephen- I didn't answer your question and I see why you asked. The read does not always increase. If the equipment doesn't operate then the read will sometimes be the same so I get an #N/A as result on those days. Would there be a way to add another "If" function to cure it?
 
Upvote 0
B2: =A2
B3: =IF(A2="",B2,(INDEX(A3:A$16,MATCH(TRUE,A3:A$16<>"",))-A2)/MATCH(TRUE,A3:A$16<>"",)) Array-entered


Excel 2010
AB
1ReadResult
23535.00
3-2.50
430-2.50
5-0.67
6-0.67
728-0.67
819.67
919.67
108719.67
1180-7.00
12-2.50
1375-2.50
148.33
158.33
161008.33
Sheet1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,189
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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