December 17, 2020

Hi,

When I am using an array function like in this video.

Some cells show the result #N/A.

I used to add the IFERROR for any formula resulted #N/A like VLOOKUP.

But when I tried to add IFERROR to an array formula like the multi mode function in this video it gives me an error.

Any idea how to do so?

Thanks

Trusted Members

Moderators

November 1, 2018

The error is not actually returned by the formula, which is why IFERROR doesn't work, it's because the result array has fewer 'rows' than the range you have entered the formula into, so Excel reflects that by showing you #N/A. You could use this normally entered formula entered into H2 and copied down:

=IF(COUNT(MODE.MULT($B$2:$D$21))<ROWS($A$1:$A1),"",INDEX(MODE.MULT($B$2:$D$21),ROWS($A$1:$A1)))

Answers Post

December 17, 2020

@Velouriarn

Thanks a lot for your reply.

Yes that is exactly what I am looking for 🙂

Please, is it possible that you may thankfully explain the formula you provided above as you used several functions within it.

Also, does using the formula your provided convert this formula from an array to regular formula?

As I did double clicked each part of the formula to check its arguments and tried to understand what you did, but I am afraid that I am not getting it correctly as fine.

If you have some few minutes to write the logic you followed that would be awesome and I do appreciate your valuable time.

Thanks my friend 🙂

MG!

Trusted Members

Moderators

November 1, 2018

COUNT(MODE.MULT($B$2:$D$21)) tells you how many numbers are returned by your original function (7 in this example)

ROWS($A$1:$A1) returns a sequence from 1 as you copy it down (since it becomes ROWS($A$1:$A2), then ROWS($A$1:$A3 and so on)

so for each row, the first part of the formula checks if the number of values in the result array is less than the number of rows we have copied the formula into, and returns "" if we have run out of numbers.

Now, since MODE.MULT($B$2:$D$21) returns an array of numbers, we can pass this to an INDEX function to return one specific value. In the first formula row, we are using:

INDEX(MODE.MULT($B$2:$D$21),ROWS($A$1:$A1))

which is the same as:

INDEX(MODE.MULT($B$2:$D$21),1)

so it returns the first value in the array. In the next row, ROWS($A$1:$A2) returns 2, so we get the second value, and so on.

Does that help?

Trusted Members

Moderators

November 1, 2018

December 23, 2020

Adding the MODE.MULT() function using Ctr+Alt+Del will return the #N/A errors you found because that is what it was designed to do. It is telling you that you have just selected too many alternatives and, in your case, there are just 7 modal values

If you use MODE.MULT() as a **Dynamic Array function**, that is, enter the function in H2 in your file and just press Enter, it will SPILL the correct answers to H8 and you will not see the #N/A errors. Hence, no need to worry about using the IFERROR() function if all else is well!

1 Guest(s)