Average a row of a range if the letter "i" is typed in - range has to be dynamic.

mt206689

New Member
Joined
Dec 6, 2015
Messages
2
This is my first post on here, so I apologize if I leave out details or do not explain something well enough.

I have a range, where values between 1 and 5 are entered manually depending on how well someone scored, and a total row that calculates the averages of the column per section. If there is insufficient data to get a score, the letter "i" should be typed instead of a value between 1 and 5. If the "i" is typed in, it should calculate the average value of the row - here is an example of my table:

Emply #1Emply #2Emply #3Emply #4
Section #1
Criteria #15.04.03.02.0
Criteria #25.05.0i5.0
Criteria #35.05.02.0i
Average5.04.673.333.67

<tbody>
</tbody>

So as seen above, the "i" under employee #3 would be calculated in the total row below as a 5, since the row has an average of 5.0 for criteria #2 - [calculated average (5 + 5 + 5)/3 = 15/3 = 5.0].

The i under Employee #4 would be calculated as 4.0 as the average for the row in Criteria #3 -
[calc: (5 + 5 + 2)/3 = 12/3 = 4.0]. I came up with a formula with works, but I want to make this range dynamic as I will be adding rows and columns, and deleting rows and columns as the survey changes. Here is the formula that currently works, but not dynamic. {formula entered in total row of employee#1}

=AVERAGE(IF(B3="I",AVERAGE($B3:$E3),B3),IF(B4="I",AVERAGE($B4:$E4),B4),IF(B5="I",AVERAGE($B5:$E5),B5))

Without going into to much depth, I cannot use tables or pivot tables (such as using table references) as this will restrict me in other areas. I am sure there is a way to do this with Index and match in an array, but I cannot figure this one out.

If anyone has ideas, please let me know, and if you need more info, I will get back to you as soon as I can.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I have found a solution after many days of trying with success. What I did was added a static column (lets say Column F) which calculates the average of each row. Then I added the following calculation to the total row under Employee #1:

{=AVERAGE(IF(B$1:B$3="I",$F$1:$F$3,B$1:B$3))} - notice that this is an array (you must select Ctrl + Shift + Enter when you insert the formula).

The way that I set it up where if I add a row or column, it will not break the formula, and will include the value of that row (where my old formula would be skipped on the new row). Note that I will be using VBA to add in columns and rows as to copy the formulas over/across, else you will need to manually insert row/column and copy the formulas.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,862
Members
449,052
Latest member
Fuddy_Duddy

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