Solve #VALUE errors of average formula, when the analyzed cell contains strings of length 0

vladimiratanasiu

Active Member
Joined
Dec 17, 2010
Messages
348
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hello!

I posted a message (Progressive average formula that counts also blank cells), regarding a formula to calculate the progressive average for more ranges of cells (including also the blank cells when counting). I got a solution that works very fine, but only for the tables with blank cells that don't have strings of length 0. When I tried to integrate such a table in a larger workbook, I had to link its cells with other ones by ISBLANK formulas, to return blank cell if the source contains no value. In the attached file, the range I2:I53 (without totals) is the source of data, that are imported automatically in the range C2:C53. In column E, it's calculated the progressive average of all values from column C at one date, between January 2021 and the month in line with that cell. In this point I meet a big trouble, because if I have to use the ISBLANK formula. If I keep it in all cells from C2:C53 (excepting totals), the first cell that is blank by formula (C13) returns #VALUE error in E13 all next ones from column E (E14:E55). I was suggested to delete formulas from all C column blank cells, to avoid Excel consider their content strings of length 0. If I remove formula from C13, progressive average formula works without problems to the next cell blank from column C (C20). And so on. But doing in this way, the two tables are not linked completly and may generate wrong results. How could be adjusted / changed the formulas from columns E and / or C, so that the errors be removed / avoided completly?

Thank you!


2024(1).xlsx
ABCEFGHI
1YearMonthMonthly energy consumption (Kwh)Source table
22021Jan-2167.8267.822021Jan-2167.82
3Feb-2161.2564.54Feb-2161.25
4Mar-2159.1962.75Mar-2159.19
5Apr-2148.3659.16Apr-2148.36
6May-2149.9757.32May-2149.97
7Jun-2148.3655.83Jun-2148.36
8Jul-2149.9754.99Jul-2149.97
9Aug-2116.1250.13Aug-2116.12
10Sep-216752.00Sep-2167
11Oct-211147.90Oct-2111
12Nov-214447.55Nov-2144
13Dec-21 #VALUE!Dec-21
14Total523.04 Total523.04
152022Jan-2254#VALUE!2022Jan-2254
16Feb-2266#VALUE!Feb-2266
17Mar-2278#VALUE!Mar-2278
18Apr-2268#VALUE!Apr-2268
19May-22-10#VALUE!May-22-10
20Jun-22 #VALUE!Jun-22
21Jul-22 #VALUE!Jul-22
22Aug-2249#VALUE!Aug-2249
23Sep-2227#VALUE!Sep-2227
24Oct-2251#VALUE!Oct-2251
25Nov-22 #VALUE!Nov-22
26Dec-22 #VALUE!Dec-22
27Total383 Total383
282023Jan-23 #VALUE!2023Jan-23
29Feb-23 #VALUE!Feb-23
30Mar-23106#VALUE!Mar-23106
31Apr-2396#VALUE!Apr-2396
32May-2346#VALUE!May-2346
33Jun-23188#VALUE!Jun-23188
34Jul-23 #VALUE!Jul-23
35Aug-23139#VALUE!Aug-23139
36Sep-2352#VALUE!Sep-2352
37Oct-23109#VALUE!Oct-23109
38Nov-2341#VALUE!Nov-2341
39Dec-2346#VALUE!Dec-2346
40Total823 Total823
412024Jan-2462#VALUE!2024Jan-2462
42Feb-2455#VALUE!Feb-2455
43Mar-24  Mar-24
44Apr-24  Apr-24
45May-24  May-24
46Jun-24  Jun-24
47Jul-24  Jul-24
48Aug-24  Aug-24
49Sep-24  Sep-24
50Oct-24  Oct-24
51Nov-24  Nov-24
52Dec-24  Dec-24
53Total117 Total117
Sheet1
Cell Formulas
RangeFormula
C41:C52,C28:C39,C15:C26,C2:C13C2=IF(ISBLANK(I2),"",I2)
C14,C53,C40,C27C14=SUM(C2:C13)
E2,E4:E53E2=IF(OR($B2="Total",SUMIF($B2:$B$53,"<>"&"Total",$C2:$C$53)=0),"",SUMPRODUCT($C$2:$C2*($B$2:$B2<>"Total"))/SUMPRODUCT(1*($B$2:$B2<>"Total")))
E3E3=IF(OR($B3="Total",SUMIF($B3:$B$53,"<>"&"Total",$C3:$C$53)=0),"",SUMPRODUCT($C$2:$C3*($B$2:$B3<>"Total"))/SUMPRODUCT(1*($B$2:$B3<>"Total")))
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I have given the formula in Post#17 of thread

Progressive average formula that counts also blank cells​

This is an ARRAY formula. In E2 copied down.
=IF(OR($C2="Total",SUMIF($C2:$C$53,"<>"&"Total",$D2:$D$53)=0),"",SUM(IFERROR($D$2:$D2*($C$2:$C2<>"Total"),0))/SUMPRODUCT(1*($C$2:$C2<>"Total")))
Excel Formula:
To enter ARRAY formula
Copy and paste the formula in cell
Press F2
Press Ctrl+Shift+Enter together
Excel covers the formula with {}.
 
Upvote 0

Forum statistics

Threads
1,224,798
Messages
6,181,038
Members
453,013
Latest member
Shubashish_Nandy

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