Average formula in Excel - excel

I'm working on a spreadsheet and I need to have a set of cells ignored if they are blank. I tried a regular average formula as well as if statements and nothing seems to be working. The values need to be adjusted so they come to a common value. Here is the formula I am trying to use to calculate the average.
=(AVERAGE(D4,(F4*0.6),(H4*(6/7))))
This formula will calculate the average but is not ignoring cells that do not have a value.

Excel should automatically ignore truly blank cells when using the =Average() formula. However, if you do have some "0" data or space characters, you could use the following to find the average of anything that is numeric:
=SUM(A:A)/COUNT(A:A)
Where A:A is your range.
EDIT: Simplified to use Count which only finds numeric cells.
EDIT 2: Given your specific example, the average function could look as follows:
=IFERROR((D4 + (F4*0.6) + (H4*(6/7)))/COUNTA(D4,F4,H4), 0)

Related

Excel - How to count the number of distinct texts of a specific date inside a table?

I'm trying to count the number of distinct text from a specific date in a data table.
Data Sample with expect result :
I was able to figure out how to count the distinct element from a range I specify, because I can determine the first and last row containing the date.
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
I have tried to modify my formula so that it determines the cell range by itself but without success.
I searched for an answer, using a combination of CELL and MAXIFS, example below, but Excel does not accept the formula.
=CELL("row",MAXIFS(A2:A15,A2:a15,D2))
I've looked at the INDEX formula, but I can't figure out how to do what I want to do. 😑
Any idea what I'm doing wrong, or what I should be doing instead?
Thanks, I appreciate it!
If you have Office 365 and the new Dynamic Arrays, this sort of formula has become ridiculously easy.
This formula in cell E3:
=COUNTA(UNIQUE(FILTER($B$2:$B$15,$A$2:$A$15=D3)))
Copy down.
You can also generate the unique list of dates with this formula in D3, which spills down automatically and does not need to be copied.
=UNIQUE(A2:A15)
It wasn't easy, but by separating each step of the problem, I was able to solve it.
Note that my solution only works because my dates are sorted.
Here's the final formula in the cell "One formula to rule them all":
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2))),INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)))))
Here are my explanations of my process:
Formula if I select the range :
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
Formula to get the first iteration
=ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2)
Formula to get the last iteration
{=ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)}
Create range from two addresses
=INDIRECT(CONCATENATE(F3,":",G3))
Formula giving me the expect result
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(F3,":",G3)),INDIRECT(CONCATENATE(F3,":",G3))))

How to simplify multiple COUNTIFS in excel with non-consecutive ranges

I have a spreadsheet...
A you can see, the cell F2 has a formula with multiple COUNTSIF, basicly checks the cells F14, F33, F62 y there is a Pass there, and if there is one will give you a % completion. My question is that I have to add around 20-30 COUNTIFS to that formula, is there a way to simplify it.
=(COUNTIF(F14,"Pass")+COUNTIF(F33,"Pass")+COUNTIF(F62,"Pass")+COUNTIF(F75,"Pass")+COUNTIF(F88,"Pass")+COUNTIF(F105,"Pass"))/(COUNTIFS(F14,"<>na")+COUNTIFS(F33,"<>na")+COUNTIFS(F62,"<>na")++COUNTIFS(F75,"<>na")++COUNTIFS(F88,"<>na")+COUNTIFS(F105,"<>na"))
This is not the final formula, still missing around 20 entries. If you're wondering why not do a simple F15:FXX, because i just need the cells that have a test case name, like F14, F33, etc.
For the first part of your formula, you can use the INDEX function to return a non-contiguous set of values, which you can test.
For example, the equivalent for the first part would be:
=SUM(N(INDEX($F:$F,IF(1,N({14,33,62,75,88,105})))="Pass"))
The IF(1,N({…})) part is how you specify which cells (rows) in Column F to return.
Without knowing more about your data, not sure about handling the percentage issue.
Your posted formula would not calculate a percentage, as it is only dividing the SUM by whether or not F14<>"na" is true, and then adding one for the <>"na" factor for the rest
In earlier versions of Excel, you may need to confirm this array formula, hold down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula seen in the formula bar.
If you want to return the percent "pass" in your list of cells, merely divide the SUM by the number of cells. You can either hard-code that number, or compute it with something like:
COLUMNS({14,33,62,75,88,105})
Or all together:
=SUM(N(INDEX($F:$F,IF(1,N({14,33,62,75,88,105})))="Pass"))/6
or
=SUM(N(INDEX($F:$F,IF(1,N({14,33,62,75,88,105})))="Pass"))/COLUMNS({14,33,62,75,88,105})

excel indicate range of numbers by smallest and largest defined in two individual cells

I'm looking to find missing numbers within 1000s of numbers in the first column.
I came across this formula;
=SMALL(IF(ISNA(MATCH(ROW(A$1:A$30),A$1:A$30,0)),ROW(A$1:A$30)),ROW(A1))
which works, except there is a problem.
In the formula it is using row numbers 1 to 30 , as defined by A$1:A$30 for lookup value in the MATCH formula
MATCH(lookup_value, lookup_array, [match_type])
in my application, the number of rows is not always going to be the same. I need to be able to indicate the range of values of which I want it to be compared against. By defining the min and max
I intent to feed it well into thousands of set of numbers each with thousands of rows. So changing the lookup value by row range everytime is not going to be feasible.
I want it to be able to read this range with min and max defined in two other cells.
As such;
=SMALL(IF(ISNA(MATCH(*1 to 5000*,A$1:A$30,0)),ROW(A$1:A$30)),ROW(A1))
where 1 is in cell lets say E1 and 5000 is in cell E2
obviously this doesn't work, so i'm looking for an answer regarding on how to define a range of numbers with min and max in two other cells.
Use INDEX to return the correct range:
=SMALL(IF(ISNA(MATCH(ROW(INDEX(A:A,$E$1):INDEX(A:A,$E$2)),A:A,0)),ROW(INDEX(A:A,$E$1):INDEX(A:A,$E$2))),ROW(A1))
This is an array formula and must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

Find a proper formula to calculate average with zero when cells are blank

I have a formula to calculate sum of 3 cells one of them is a product of average of other three cells. the problem is when calculating the average of these cells while they are blank it gives error Div/0 and then the corresponding calculations are error too
maybe the solution is that if I want to calculate average of range of blank cells that the result to be zero but I dont know how to do this.
Replace your formula with =IFERROR(<Your formula>, 0) to avoid getting unwanted errors with blank cells.
If you're using spanish version, you should use: =SI.ERROR(<Your formula>; 0). Note the change between , and ; between versions.
Thanks to #ForwardEd for noting my mistake!

Excel Summing Formula setting against month date using SUMPRODUCT

I am trying sum rows that have the same month date. I have a formula that operates with columns but fails when rows are requested. I will show the formulas that I have tried, but I am now stuck. Any advise would be much appreciated.
=SUMPRODUCT(--(MONTH($A$9:$A$50)=5),$B$9:$B$50)
This array works fine with a column
=SUMPRODUCT(--(MONTH($A$9:$A$50)=5),$B$9:**$H$50**)
see the bold reference which comprises a series of cells set out in rows.
SUMPRODUCT normally expects ranges to be the same size but you can get the result you need with a change to the syntax, i.e.
=SUMPRODUCT((MONTH($A$9:$A$50)=5)*$B$9:$H$50)
You can't have any text in B9:H50 otherwise you will get #VALUE! error. If you do have text in that range then you can use this version, which should ignore the text and give you a result
=SUMPRODUCT((MONTH($A$9:$A$50)=5)*ISNUMBER($B$9:$H$50),$B$9:$H$50)

Resources