Forum

Notifications
Clear all

How to remove #N/A from cell if I am using an array formula and can not use IFERROR function

10 Posts
4 Users
0 Reactions
514 Views
(@mgbasheerh)
Posts: 13
Eminent Member
Topic starter
 

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

 
Posted : 23/12/2020 3:55 pm
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
 

Hi,

Please attach your workbook so we can see what you are doing.

Regards

Phil

 
Posted : 23/12/2020 6:41 pm
(@mgbasheerh)
Posts: 13
Eminent Member
Topic starter
 

Hi Philip,

OK, check attached file.

Thanks

 
Posted : 24/12/2020 2:01 am
(@debaser)
Posts: 837
Member Moderator
 

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)))

 
Posted : 24/12/2020 6:11 am
(@mgbasheerh)
Posts: 13
Eminent Member
Topic starter
 

@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!

 
Posted : 24/12/2020 10:07 am
(@debaser)
Posts: 837
Member Moderator
 

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?

 
Posted : 24/12/2020 12:28 pm
(@mgbasheerh)
Posts: 13
Eminent Member
Topic starter
 

Thanks a lot and much appreciated.

And why there is an IF in the early beginning of the formula? as you did not mentioned its usage in your reply.

Thanks a lot 🙂

 
Posted : 24/12/2020 1:47 pm
(@debaser)
Posts: 837
Member Moderator
 

Sorry, it was implicit in this sentence:

 

"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"

 
Posted : 25/12/2020 6:39 am
(@mgbasheerh)
Posts: 13
Eminent Member
Topic starter
 

Totally much appreciated your time to explain it in detail.

 
Posted : 25/12/2020 6:44 am
(@duncanwil)
Posts: 11
Active Member
 

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!

 
Posted : 26/12/2020 7:32 pm
Share: