Median which Excludes Zeros Using the Index/Match Function across Worksheets

94mustang

Board Regular
Joined
Dec 13, 2011
Messages
133
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello Excel Forum Team,

I am using the desktop client version of Excel (Microsoft 365 MSO Version 2303). I am needing to calculate the Median across multiple worksheets which exclude zeros or text. I realized that the Median is NOT removing the zeros or text from the other worksheets. As you can see in my post, I am using the Index/Match function to calculate the Median. The other thing I noticed was that the median will not calculate unless all worksheets are filled in. How can the Median function be written so that I can calculate the matching identifier to the other worksheets while excluding the zeros or text in the cells. My company has disabled macros so I cannot seem to figure out how to post a "mini-sheet" using XL2BB. I do have it as an add-in, but it will not let me select a range. See screenshot below. I will do my best to provide the formula in the Score column. Formula is below the screenshot.

A further note, all the risks and opportunities will be copied to all the worksheets, and the unique Identifier will stay with the same row (record) of information. Each row will have a unique identifier number associated with based on the selection of the Value Proposition and Risk/Opportunity columns.

1686238882515.png
1686238899836.png


1686237983004.png

The formulas below are in a summary sheet which is the screenshot above.

B:B Col
=IF(OR(F3="",G3=""),"",CONCATENATE(LEFT(F3,1),LEFT(G3,1)))

C:C Col
=IF(B3="","",CONCATENATE(B3," - ",TEXT(COUNTIF($B$3:B3,B3),"000")))

H:H Col
=IFERROR(MEDIAN(
INDEX(Assoc01!$L$3:$L$201,MATCH(C3,Assoc01!$C$3:$C$201,0)),
INDEX(Assoc02!$L$3:$L$201,MATCH(C3,Assoc02!$C$3:$C$201,0)),
INDEX(Assoc03!$L$3:$L$201,MATCH(C3,Assoc03!$C$3:$C$201,0)),
INDEX(Assoc04!$L$3:$L$201,MATCH(C3,Assoc04!$C$3:$C$201,0)),
INDEX(Assoc05!$L$3:$L$201,MATCH(C3,Assoc05!$C$3:$C$201,0)),
INDEX(Assoc06!$L$3:$L$201,MATCH(C3,Assoc06!$C$3:$C$201,0)),
INDEX(Assoc07!$L$3:$L$201,MATCH(C3,Assoc07!$C$3:$C$201,0)),
INDEX(Assoc08!$L$3:$L$201,MATCH(C3,Assoc08!$C$3:$C$201,0)),
INDEX(Assoc09!$L$3:$L$201,MATCH(C3,Assoc09!$C$3:$C$201,0)),
INDEX(Assoc10!$L$3:$L$201,MATCH(C3,Assoc10!$C$3:$C$201,0))),"")

Basically, if each sheet (Assoc01, Assoc02, etc) has a value (col L: Score), then I want the value to be included in the median, otherwise, exclude empty cells, zeros, or text. Below is a visual of the "Assoc01" worksheet.

1686238342802.png
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
How about
Excel Formula:
=LET(v,CHOOSECOLS(VSTACK(Assoc1:Assoc10!C$3:L$201),1,-1),MEDIAN(INDEX(FILTER(v,(INDEX(v,,1)=C3)*(ISNUMBER(INDEX(v,,2)))),,2)))

Re XL2BB have a look here XL2BB Icons greyed out
 
Upvote 0
Thank you for the XL2BB link. That link resolved my issue so thank you so much.

I am getting the "#NAME?" error in the cell. See below.

Risks and Opps Log.xlsx
ABCDEFGHIJ
1
2AbbrIdentifierDate AddedDescriptionValue PropositionRisk/OpportunityScoreRangeDetail Current Controls
3CRCR - 001Coach/MentorRisk#NAME?19
4    
Risks and Opps Log Summary
Cell Formulas
RangeFormula
B3:B4B3=IF(OR(F3="",G3=""),"",CONCATENATE(LEFT(F3,1),LEFT(G3,1)))
C3:C4C3=IF(B3="","",CONCATENATE(B3," - ",TEXT(COUNTIF($B$3:B3,B3),"000")))
H3H3=LET(v,CHOOSECOLS(VSTACK(Assoc1:Assoc10!C$3:L$201),1,-1),MEDIAN(INDEX(FILTER(v,(INDEX(v,,1)=C3)*(ISNUMBER(INDEX(v,,2)))),,2)))
I3:I4I3=IFERROR(IF(MAX( INDEX(Assoc01!$L$3:$L$301,MATCH(C3,Assoc01!$C$3:$C$301,0)), INDEX(Assoc02!$L$3:$L$301,MATCH(C3,Assoc02!$C$3:$C$301,0)), INDEX(Assoc03!$L$3:$L$301,MATCH(C3,Assoc03!$C$3:$C$301,0)), INDEX(Assoc04!$L$3:$L$301,MATCH(C3,Assoc04!$C$3:$C$301,0)), INDEX(Assoc05!$L$3:$L$301,MATCH(C3,Assoc05!$C$3:$C$301,0)), INDEX(Assoc06!$L$3:$L$301,MATCH(C3,Assoc06!$C$3:$C$301,0)), INDEX(Assoc07!$L$3:$L$301,MATCH(C3,Assoc07!$C$3:$C$301,0)), INDEX(Assoc08!$L$3:$L$301,MATCH(C3,Assoc08!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc10!$L$3:$L$301,MATCH(C3,Assoc10!$C$3:$C$301,0))) -MIN( INDEX(Assoc01!$L$3:$L$301,MATCH(C3,Assoc01!$C$3:$C$301,0)), INDEX(Assoc02!$L$3:$L$301,MATCH(C3,Assoc02!$C$3:$C$301,0)), INDEX(Assoc03!$L$3:$L$301,MATCH(C3,Assoc03!$C$3:$C$301,0)), INDEX(Assoc04!$L$3:$L$301,MATCH(C3,Assoc04!$C$3:$C$301,0)), INDEX(Assoc05!$L$3:$L$301,MATCH(C3,Assoc05!$C$3:$C$301,0)), INDEX(Assoc06!$L$3:$L$301,MATCH(C3,Assoc06!$C$3:$C$301,0)), INDEX(Assoc07!$L$3:$L$301,MATCH(C3,Assoc07!$C$3:$C$301,0)), INDEX(Assoc08!$L$3:$L$301,MATCH(C3,Assoc08!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc10!$L$3:$L$301,MATCH(C3,Assoc10!$C$3:$C$301,0)))=0,"", MAX( INDEX(Assoc01!$L$3:$L$301,MATCH(C3,Assoc01!$C$3:$C$301,0)), INDEX(Assoc02!$L$3:$L$301,MATCH(C3,Assoc02!$C$3:$C$301,0)), INDEX(Assoc03!$L$3:$L$301,MATCH(C3,Assoc03!$C$3:$C$301,0)), INDEX(Assoc04!$L$3:$L$301,MATCH(C3,Assoc04!$C$3:$C$301,0)), INDEX(Assoc05!$L$3:$L$301,MATCH(C3,Assoc05!$C$3:$C$301,0)), INDEX(Assoc06!$L$3:$L$301,MATCH(C3,Assoc06!$C$3:$C$301,0)), INDEX(Assoc07!$L$3:$L$301,MATCH(C3,Assoc07!$C$3:$C$301,0)), INDEX(Assoc08!$L$3:$L$301,MATCH(C3,Assoc08!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc10!$L$3:$L$301,MATCH(C3,Assoc10!$C$3:$C$301,0))) -MIN( INDEX(Assoc01!$L$3:$L$301,MATCH(C3,Assoc01!$C$3:$C$301,0)), INDEX(Assoc02!$L$3:$L$301,MATCH(C3,Assoc02!$C$3:$C$301,0)), INDEX(Assoc03!$L$3:$L$301,MATCH(C3,Assoc03!$C$3:$C$301,0)), INDEX(Assoc04!$L$3:$L$301,MATCH(C3,Assoc04!$C$3:$C$301,0)), INDEX(Assoc05!$L$3:$L$301,MATCH(C3,Assoc05!$C$3:$C$301,0)), INDEX(Assoc06!$L$3:$L$301,MATCH(C3,Assoc06!$C$3:$C$301,0)), INDEX(Assoc07!$L$3:$L$301,MATCH(C3,Assoc07!$C$3:$C$301,0)), INDEX(Assoc08!$L$3:$L$301,MATCH(C3,Assoc08!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc09!$L$3:$L$301,MATCH(C3,Assoc09!$C$3:$C$301,0)), INDEX(Assoc10!$L$3:$L$301,MATCH(C3,Assoc10!$C$3:$C$301,0)))),"")
H4H4=IFERROR(MEDIAN( INDEX(Assoc01!$L$3:$L$201,MATCH(C4,Assoc01!$C$3:$C$201,0)), INDEX(Assoc02!$L$3:$L$201,MATCH(C4,Assoc02!$C$3:$C$201,0)), INDEX(Assoc03!$L$3:$L$201,MATCH(C4,Assoc03!$C$3:$C$201,0)), INDEX(Assoc04!$L$3:$L$201,MATCH(C4,Assoc04!$C$3:$C$201,0)), INDEX(Assoc05!$L$3:$L$201,MATCH(C4,Assoc05!$C$3:$C$201,0)), INDEX(Assoc06!$L$3:$L$201,MATCH(C4,Assoc06!$C$3:$C$201,0)), INDEX(Assoc07!$L$3:$L$201,MATCH(C4,Assoc07!$C$3:$C$201,0)), INDEX(Assoc08!$L$3:$L$201,MATCH(C4,Assoc08!$C$3:$C$201,0)), INDEX(Assoc09!$L$3:$L$201,MATCH(C4,Assoc09!$C$3:$C$201,0)), INDEX(Assoc10!$L$3:$L$201,MATCH(C4,Assoc10!$C$3:$C$201,0))),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B3:R201Expression=$N3="Extreme"textNO
B3:R201Expression=$N3="High"textNO
B3:R201Expression=$N3="Medium"textNO
B3:R201Expression=$N3="Low"textNO
B3:R201Expression=$N3="Very Low"textNO
B3:R201Expression=MOD(ROW(),2)=0textNO
B3:R201Expression=MOD(ROW(),2)=1textNO
Cells with Data Validation
CellAllowCriteria
E3:F201ListEducate,Coach/Mentor,Partner,Recognize,Discover
G3:G201List='R&O Criteria'!$B$38:$C$38
 
Upvote 0
You shouldn't be getting a #name error with version 2303 of 365.
Do you have the VSTACK function?
 
Upvote 0
Yes, I do have the VSTACK function. I, too, was looking to see if I had that function to see if I could figure out why I was getting this error. I also checked the LET, CHOOSECOLS, & FILTER because I have never used those in a function before and I do have all of them in my version of Excel.
 
Upvote 0
I missed the leading 0 on the sheet number for the 1st sheet, try
Excel Formula:
=LET(v,CHOOSECOLS(VSTACK(Assoc01:Assoc10!C$3:L$201),1,-1),MEDIAN(INDEX(FILTER(v,(INDEX(v,,1)=C3)*(ISNUMBER(INDEX(v,,2)))),,2)))
 
Upvote 0
Solution
Works perfectly. You were a tremendous help and have introduced me to new functions to study and understand. Thank you so very much.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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