# Help with excel calculation

#### lostboyca

##### Board Regular

% Comp. (H10) = I need to do a calculation such as: IF there is text in a cell J11:O26 count each cell as one THEN DIVIDE by the number of cells in J11:O26 which will give me the percentage.

This will be the start but there are more calculations but this will help me start it out.

Thanks

lostboyca

### Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
=(COUNTA(J11:O26)+COUNTBLANK(J11:O26)) will give total
to get the percentage use the first formula then divide
like this
=COUNTA(J11:O26)/(COUNTA(J11:O26)+COUNTBLANK(J11:O26))

Thanks for the calculation now I have another question.

I need another calculation for H5 I would like it to calculate the following

I would like it to count all cells containing the text Pass in J11:O26 plus J29:O36 plus J39:O59 then divide all cells with and without text on J11:O26 plus J29:O36 plus J39:O59 which should give me the average

Thanks,

lostboyca

Hi lostboyca:

How about the following array formula ...

=(COUNTIF(J11:O26,"pass")+COUNTIF(J29:O36,"pass")+COUNTIF(J39:O59,"pass"))/(COUNTA(J11:O59&"")-COLUMNS(J:O)*(ROWS(1:4)))

Here is a formula without using arrays

=COUNTA(J11:O26,J29:O36,J39:O59)/(COUNTA(J11:O26,J29:O36,J39:O59)+COUNTBLANK(J11:O26,J29:O36,J39:O59))

Try...

=AVERAGE(IF(1-ISNUMBER(MATCH(ROW(J11:O59)-ROW(J11)+1,{17,18,27,28},0)),(J11:O59="Pass")+0))

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!

Yogi Anand/Domenic –

Your script works now the question I have is that can you break down the script in English? I want to add more rows and cells to the calculation.

Chitosunday –
Your script did not work it error out and highlighted COUNTBLANK(J11:O26,J29:O36,J39:O59))

Thanks,

Lostboyca

lostboyca said:
Your script works now the question I have is that can you break down the script in English? I want to add more rows and cells to the calculation.

With regards to my formula...

1) replace the references to J11:O59 with references to your new range, and

2) change the array constant {17,18,27,28} to specify which row, relative to the first row in your table, to exclude from the calculation. In this case, rows 17, 18, 27, and 28 are excluded from the calculation.

Great thanks for all the help!!!!

Replies
2
Views
402
Replies
10
Views
334
Replies
22
Views
537
Replies
2
Views
242
Replies
4
Views
277

1,216,537
Messages
6,131,237
Members
449,637
Latest member
icecreampie

### 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.

### Which adblocker are you using?

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

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