Array Formula not displaying results

pluginguin

New Member
Joined
Aug 10, 2016
Messages
21
Office Version
  1. 2019
Platform
  1. Windows
Please check out my Excel Range.
The Array Formula should copy all ItemCodes from Sheet 1 to Sheet 2, where "Below Stocklevel" value = 1.
But somehow it's doesn't do anything. What am I missing?

This is the source table: (Sheet1)
ItemCodeBelow StockLevel
1300011​
0​
130021​
0​
130022​
0​
130023​
0​
130024​
0​
130025​
0​
300031​
0​
300101​
0​
300102​
1​
300103​
0​
300104​
0​
300141​
1​
300142​
0​
300143​
1​

And this is the result table (sheet2) with the array formula

ItemCode
{=IF.ERROR(INDEX(Sheet1!A$2:A$15;SMALL(IF(B$2:B$15=1;ROW(A$2:A$15));ROW(1:1))-1;1);"")}

I expect to see the values 300102 and 300143 but in stead I see nothing.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Just updated my account details (Windows and Office 2019)
 
Upvote 0
Thanks for that, how about
Excel Formula:
=IFERROR(INDEX(Sheet1!$A$2:$A$15,AGGREGATE(15,6,(ROW(Sheet1!$A$2:$A$15)-ROW(Sheet1!$A$2)+1)/(Sheet1!$B$2:$B$15=1),ROWS(A$2:A2))),"")
 
Upvote 0
Hi Fluff,

Yep, that function is working.
But I have another issue now.
The example I gave you was flat data.

My actual sheet1 contains data imported from a csv that refreshes periodically.
Each column of sheet1 is a defined range, so that it always looks at the correct amount of rows, also when the amount of rows changes after an update.

To work in my worksheet I need to modify the ranges in your formula and there are 2 parts of the formula I don't know how to modify so that it still works.
  • In sheet1, column A has a defined range called "Stock"
  • In sheet1, column B has a defined range called "StockLevel"

This is how I have modified your formula
Excel Formula:
=IFERROR(INDEX(Stock,AGGREGATE(15,6,(ROW(Stock)-ROW(Stock!$A$2)+1)/(StockLevel=1),ROWS(A$2:A2))),"")

The parts I'm unsure about are:
-ROW(Stock!$A$2)+1)
and
ROWS(A$2:A2)

The modified code now displays a result, but when I copy down the formula, each row gets the same data. And the single result I do get is incorrect.
Can you understand what's happening with these defined ranges and how to incorporate them into the formula correctly?
 
Upvote 0
To use named ranges you need to do it like
Excel Formula:
=IFERROR(INDEX(Stock,AGGREGATE(15,6,(ROW(Stock)-MIN(ROW(Stock))+1)/(StockLevel=1),ROWS(A$2:A2))),"")
Also both named ranges need to be the same size.
 
Upvote 0
Solution
Yes, the named ranges are always the same size.

I am a bit closer now.
The first result now is a correct result.
But when i copy down the formula I still get the same result on each row.
 
Upvote 0
It should work
++Fluff.xlsm
AB
1ItemCodeBelow StockLevel
213000110
31300210
41300220
51300230
61300240
71300250
83000310
93001010
103001021
113001030
123001040
133001411
143001420
153001431
Sheet1


++Fluff.xlsm
A
1
2300102
3300141
4300143
5 
6 
7 
Sheet2
Cell Formulas
RangeFormula
A2:A7A2=IFERROR(INDEX(Stock,AGGREGATE(15,6,(ROW(Stock)-MIN(ROW(Stock))+1)/(StockLevel=1),ROWS(A$2:A2))),"")
Named Ranges
NameRefers ToCells
Stock=Sheet1!$A$2:$A$15A2:A7
StockLevel=Sheet1!$B$2:$B$15A2:A7


Are you sure that the stock levels are actual numbers & not text.
 
Upvote 0
They are a formula result. But the format of that column is "Number".
On the example file the formula is working as you said it should.
Sadly not on the file it should be working on.
Can I share my original file somewhere, so you can have a look there?
 
Upvote 0
Hmm.... I think something must have been stuck in the array formula before. I decided to delete the entire array formula from the column and recreate it. Now it's working fine!
Thanks a lot!
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
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