Removing #N/A from Array

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
How do you remove the #N/A from this array, have tried IFNA as well to no avail. The 7 in E7 refers to the top 7 sales.

Book1
ABCDE
1SalesTop7
2852599
3529297
458896
5591592
6674592
7812988
8509285
9458#N/A
105368#N/A
11174#N/A
129779#N/A
134043#N/A
14135#N/A
153996#N/A
167362#N/A
179963#N/A
Sheet2
Cell Formulas
RangeFormula
D2:D17D2=IFERROR(LARGE($A$2:$B$17,ROW(INDIRECT("1:"&E1))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try:
Book1
ABCDE
1SalesTop7
2852599
3529297
458896
5591592
6674592
7812988
8509285
9458 
105368 
11174 
129779 
134043 
14135 
153996 
167362 
179963
Sheet2
Cell Formulas
RangeFormula
D2:D16D2=IF(ROWS($D$2:D2)>$E$1,"",AGGREGATE(14,6,$A$2:$B$17,ROWS($D$2:D2)))
 
Upvote 0
Thanks Ahoy, that works fine but does that mean you can't use the IFERROR function with arrays?
 
Upvote 0
Actually your formula worked for me (see below). I just used the AGGREGATE which handles arrays without the need for CTRL-SHIFT-ENTER. I also took out the volatile function INDIRECT which can slow things down in a large data set (probably doesn't matter in this case).
Book1
ABCDE
1SalesTop7
2852599
3529297
458896
5591592
6674592
7812988
8509285
9458 
105368 
11174 
129779 
134043 
14135 
153996 
167362 
179963 
Sheet1
Cell Formulas
RangeFormula
D2:D17D2{=IFERROR(LARGE($A$2:$B$17,ROW(INDIRECT("1:"&E1))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
Try:

=IF(ROW(INDIRECT("1:"&ROWS(B2:B17)))>E1,"",LARGE($A$2:$B$17,ROW(INDIRECT("1:"&E1))))
 
Upvote 0
Actually your formula worked for me (see below). I just used the AGGREGATE which handles arrays without the need for CTRL-SHIFT-ENTER. I also took out the volatile function INDIRECT which can slow things down in a large data set (probably doesn't matter in this case).
Book1
ABCDE
1SalesTop7
2852599
3529297
458896
5591592
6674592
7812988
8509285
9458 
105368 
11174 
129779 
134043 
14135 
153996 
167362 
179963 
Sheet1
Cell Formulas
RangeFormula
D2:D17D2{=IFERROR(LARGE($A$2:$B$17,ROW(INDIRECT("1:"&E1))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
So just to clarify, my original formula worked ok and didn't return the #N/A errors?
 
Upvote 0
Actually your formula worked for me (see below).
I suspect the OP selected the whole range D2:D17, entered the formula once and confirmed into all cells at once with C+S+E whereas you entered a formula in one cell only then copied down ?
 
Upvote 0
@Tigerexcel
The IFERROR does not work because there are no errors in the formula. If you select any cell in your formula range (value or error cell) & use the formula evaluation tool you end up at the penultimate step with what is shown below. As you can see, there are no errors, but of course only 7 values. So the error is that you are trying to put a 7-value array into a 16-cell range.

1594700212862.png
 
Upvote 0
Ok thanks for explaining that Peter, IFNA produces the same thing so using this particular combination of functions I'll have to live with the #N/A?
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,260
Members
449,149
Latest member
mwdbActuary

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