Mode.Mult in dynamic table, excluding zeros, and hiding errors

larsensation

New Member
Joined
Mar 6, 2018
Messages
3
Hi,

I have a table that updates as data is entered into another sheet. I want to find the mode of this data, but exclude the zeros, since there is a lot of zeros, because data has not been entered into the original sheet yet.

Here is the formula currently being used: {=IFNA(MODE.MULT(IF(A4:X18<>0,A4:X18)),"-")}

I am getting the multiple modes, but i am still getting error messages for the spaces that don't have a value. I would like to change the #N/A to - until the data is entered and it would change automatically.

Thanks for your help!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Welcome to the board.

I assume you'e getting something like column Y here:

YZAA
1111
2222
3333
4#N/A--
5#N/A--
6#N/A--
7#N/A--
8#N/A--
9#N/A--
10#N/A--

<tbody>
</tbody>
Sheet3

Array Formulas
CellFormula
Y1:Y10{=IFNA(MODE.MULT(IF(A4:X18<>0,A4:X18)),"-")}
Z1:Z10{=IFERROR(SMALL(MODE.MULT(IF(A4:X18<>0,A4:X18)),{1;2;3;4;5;6;7;8;9;10}),"-")}
AA1:AA10{=IFERROR(SMALL(MODE.MULT(IF(A4:X18<>0,A4:X18)),ROW(INDIRECT("1:10"))),"-")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>




You select Y1:Y10, enter the formula in Y1 and confirm with Control+Shift+Enter, and you get the #N/A values after the real results. The #N/A values are appearing because the MODE.MULT is returning a 3-element array, and you selected 10 rows, so the final 7 rows have nothing to put in the cells. This is really determined after the formula (including the IFNA) has been processed. One way around that is to create an array that is the same size as the number of rows in your output selection. The Z1 formula looks for the 10 smallest values in the array returned by MODE.MULT. If there are less than 10 values, the extra will return #NUM , which IFERROR will convert to -. If you want a much longer list, you can use the version in AA1.

Hope this helps.
 
Last edited:
Upvote 0
Welcome to the board.

I assume you'e getting something like column Y here:

YZAA
1111
2222
3333
4#N/A--
5#N/A--
6#N/A--
7#N/A--
8#N/A--
9#N/A--
10#N/A--

<tbody>
</tbody>
Sheet3

Array Formulas
CellFormula
Y1:Y10{=IFNA(MODE.MULT(IF(A4:X18<>0,A4:X18)),"-")}
Z1:Z10{=IFERROR(SMALL(MODE.MULT(IF(A4:X18<>0,A4:X18)),{1;2;3;4;5;6;7;8;9;10}),"-")}
AA1:AA10{=IFERROR(SMALL(MODE.MULT(IF(A4:X18<>0,A4:X18)),ROW(INDIRECT("1:10"))),"-")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>




You select Y1:Y10, enter the formula in Y1 and confirm with Control+Shift+Enter, and you get the #N/A values after the real results. The #N/A values are appearing because the MODE.MULT is returning a 3-element array, and you selected 10 rows, so the final 7 rows have nothing to put in the cells. This is really determined after the formula (including the IFNA) has been processed. One way around that is to create an array that is the same size as the number of rows in your output selection. The Z1 formula looks for the 10 smallest values in the array returned by MODE.MULT. If there are less than 10 values, the extra will return #NUM , which IFERROR will convert to -. If you want a much longer list, you can use the version in AA1.

Hope this helps.


This worked beautifully! Thank you for your help. It is very much appreciated.
 
Upvote 0
Second Question, If I were to transpose this AND have the data set from another sheet, would this still work? I seem to get 5 dashes "-" when i enter this:

{=TRANSPOSE(IFERROR(SMALL(MODE.MULTI(IF(Sheet3!A4:X18<>0,Sheet3!A4:X18)),{1;2;3;4;5}),"-"))}
 
Upvote 0
If you select a horizontal range, say D2:H2, then this should work:

=TRANSPOSE(IFERROR(SMALL(MODE.MULT(IF(Sheet3!A4:X18<>0,Sheet3!A4:X18)),{1;2;3;4;5}),"-"))

It's exactly the same as yours, I just removed the I after MULTI.

You can also get the same effect without the transpose by making the array constant a horizontal array:

=IFERROR(SMALL(MODE.MULT(IF(Sheet3!A4:X18<>0,Sheet3!A4:X18)),{1,2,3,4,5}),"-")
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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