Using MATCH within OFFSET without a defined range size

tps49

New Member
Joined
Oct 7, 2014
Messages
26
Hi there,

I'm working on a spreadsheet that has two columns:

- The first column is the name of a particular building (i.e. 132 Wacker Drive, formatted as text)

- The second column is some designation of random letters that denotes specific qualities about the building. These letters are in groups of three and can only be A, B, or C, and can repeat (i.e. AAA is a group, AAB is a group, and so on and so forth).

What I'd like to do is use a reference cell where I can put in the name of a group (like AAA or AAB) and have it return a list of the buildings that have that group designation. My issue is that not all of the group designations have the same amount of buildings (i.e. AAA might have three buildings, AAB might have seven, etc.).

I'm thinking that the solution has to be a match function nested in an offset, but I can't think of how to make the defined range within the match dynamic...any thoughts?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Can't use that because of the reporting systems we have in place (I know that's ridiculous)...chance that there's a formula that works?
 
Upvote 0
Although I agree that it would help make things easier, but we'd end up having to write code that refreshed the Pivot Table every time someone needed a report (kind of a pain) rather than just changing the reference cell in a formula.
 
Upvote 0
Assumptions:
Building Name is in col A on 'Sheet1'
Three Letter Code is in col B on 'Sheet1'
Output is on a different worksheet - A1 has the code you want results for.

in A3:
Code:
{=IFERROR(IF(INDEX(Sheet1!$A:$A,SMALL(IF(Sheet1!$B:$B=$A$1,Sheet1!$B:$B,9E307),ROW()-2)=9E307,"",INDEX(Sheet1!$A:$A,SMALL(IF(Sheet1!$B:$B=$A$1,Sheet1!$B:$B,9E307),ROW()-2)),"")}

This is an array-entered formula. Do not type the brackets in. Use CTRL-SHIFT-ENTER to enter the formula. If Excel adds brackets, you did it right! :)
Drag the formula down as far as necessary.

Note - Since this references the entire columns, it may be slow to calculate. To help, you can put row references in the formula as well, such as:
Code:
{=IFERROR(IF(INDEX(Sheet1!$A$1:$A$1000,SMALL(IF(Sheet1!$B$1:$B$1000=$A$1,Sheet1!$B$1:$B$1000,9E307),ROW()-2)=9E307,"",INDEX(Sheet1!$A$1:$A$1000,SMALL(IF(Sheet1!$B$1:$B$1000=$A$1,Sheet1!$B$1:$B$1000,9E307),ROW()-2)),"")}
 
Upvote 0
Gsistek, something still isn't calc'ing quite right. When I remove the brackets and use ctrl shift enter to computer, i get an error message saying that I have too many arguments for the function.

After updating for the layout of my spreadsheet, the formula is:

{=IFERROR(IF(INDEX(Sheet1!$B9:$B103,SMALL(IF(Sheet1!$O9:$O103=$R$11,Sheet1!$O9:$O103,9E307),ROW()-2)=9E307,"",INDEX(Sheet1!$B9:$B103,SMALL(IF(Sheet1!$O9:$O103=$R$11,Sheet1!$O9:$O103,9E307),ROW()-2)),"")))}

Any idea what the problem might be?
 
Upvote 0
See if this works

Data in Sheet1


A
B
1
Building​
Designation​
2
Build1​
ABC​
3
Build2​
AAB​
4
Build3​
ABB​
5
Build4​
AAA​
6
Build5​
AAB​
7
Build6​
AAA​
8
Build7​
ABC​
9
Build8​
AAA​
10
Build9​
BBB​
11
Build10​
AAA​

Sheet2 (Report)


A
B
C
1
Search​
Count​
List​
2
AAA​
4​
Build4​
3
Build6​
4
Build8​
5
Build10​

Put the Designation of interest in A2

Formula in B2
=COUNTIF(Sheet1!B:B,A2)

Array formula in C2 copied down
=IF($B$2>=ROWS(C$2:C2),INDEX(Sheet1!A:A,SMALL(IF(Sheet1!$B$2:$B$500=$A$2,ROW($B$2:$B$500)),ROWS(C$2:C2))),"")

confirmed with Ctrl+Shift+Enter

Hope this helps

M.
 
Upvote 0
Marcelo,

A couple of issues with this:

- When I change the Designation of interest, the Countif updates with the correct number but the List output does not update. Oddly enough, when I shift ctrl + shift + enter in this formula, I'm not getting the brackets (and not sure why, since I got brackets for the previously-suggested solution)
- When I try to copy the array formula down, I get an #NUM error

Any thoughts?
 
Upvote 0
My mistake...
Try
{=IFERROR(IF(SMALL(IF(Sheet1!$O9:$O103=$R$11,Sheet1!$O9:$O103,9E307),ROW()-2)=9E307,"",INDEX(Sheet1!$B9:$B103,SMALL(IF(Sheet1!$O9:$O103=$R$11,Sheet1!$O9:$O103,9E307),ROW()-2))),"")}
 
Upvote 0
Marcelo, I've now got an array working but it just returns the first property name in however many spaces the array has (regardless of the count for the set, so, it'll give a name back 11 times even if the set has 4, 6, 8, or however many members)
 
Upvote 0

Forum statistics

Threads
1,215,513
Messages
6,125,253
Members
449,219
Latest member
daynle

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