Array problem

upl365

New Member
Joined
Jan 16, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi everyone!

this is my first post

I have a problem when I use the INDEX&MATCH formula to display columns,

that is, when the column is displayed there are empty cells that I cannot resolve like the image below. I want the result to be like in image B
I really thought hard to find an answer on the internet but no one could solve it

Thanks

1705394131746.png
1705394155264.png
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try this

Excel Formula:
=OFFSET(INDEX(B4:D9,,MATCH(F3,B3:D3,0)),,,COUNTA(INDEX(B4:D9,,MATCH(F3,B3:D3,0))))
 
Upvote 1
Solution
Hi, welcome to the forum!

Here's another option you can try:

Excel Formula:
=LET(CC,CHOOSECOLS(B4:D9,MATCH(F3,B3:D3,0)),FILTER(CC,CC<>""))
 
Upvote 1
Welcome to the MrExcel board!

A couple of other options.

24 01 16.xlsm
BCDEFGHIJ
1
2
31231aa
4a1abb
5b2scc
6c3ddd
7df
8f
9g
Eliminate blanks
Cell Formulas
RangeFormula
H3:H6H3=LET(c,INDEX(B4:D9,,MATCH(F3,B3:D3,0)),FILTER(c,c<>"",""))
J3:J6J3=LET(c,FILTER(B4:D9,B3:D3=F3),FILTER(c,c<>"",""))
Dynamic array formulas.
 
Upvote 1
Work perfectly
Appreciation to everyone who answered, thank you very much everyone
 
Upvote 0
You're welcome. Glad we could help. & thanks for the follow-up. :)

BTW, I note that you marked post 4 as the solution. While it works for the sample data & therefore may well work for all possible data you might have, just be aware of a couple of things.

  1. OFFSET is a volatile function so in my mind, best avoided when other non-volatile options are available, as is the case here.

  2. If it is possible that any of the blank cells might occur within the column of data, that formula will return incorrect results - see example below.

24 01 16.xlsm
BCDEFGH
1
2
31231a
4a1a0
52sc
6c3d
7df
8f
9g
Eliminate blanks (2)
Cell Formulas
RangeFormula
H3:H5H3=OFFSET(INDEX(B4:D9,,MATCH(F3,B3:D3,0)),,,COUNTA(INDEX(B4:D9,,MATCH(F3,B3:D3,0))))
Dynamic array formulas.
 
Upvote 0
You're welcome. Glad we could help. & thanks for the follow-up. :)

BTW, I note that you marked post 4 as the solution. While it works for the sample data & therefore may well work for all possible data you might have, just be aware of a couple of things.

  1. OFFSET is a volatile function so in my mind, best avoided when other non-volatile options are available, as is the case here.

  2. If it is possible that any of the blank cells might occur within the column of data, that formula will return incorrect results - see example below.

24 01 16.xlsm
BCDEFGH
1
2
31231a
4a1a0
52sc
6c3d
7df
8f
9g
Eliminate blanks (2)
Cell Formulas
RangeFormula
H3:H5H3=OFFSET(INDEX(B4:D9,,MATCH(F3,B3:D3,0)),,,COUNTA(INDEX(B4:D9,,MATCH(F3,B3:D3,0))))
Dynamic array formulas.

Hi Peter thanks for your reply, I appreciate all the answers but I really appreciate the first answer because he was the first to answer so I marked it as a solution.

For that matter, thanks for the suggestion, I am trying all the formulas that have been given and applying them to my worksheet
 
Upvote 0
I really appreciate the first answer because he was the first to answer so I marked it as a solution.
That's fine. I'm not trying to get you to change the marked solution - just making sure you are aware of potential issues associated with it.

Also note that the very fist suggestion (post 2), if you pop the INDEX/MATCH back in to locate the appropriate column instead of the hard-coded "1", is also a good way.

24 01 16.xlsm
BCDEFGH
1
2
31231a
4a1ab
5b2sc
6c3dd
7df
8f
9g
Eliminate blanks (3)
Cell Formulas
RangeFormula
H3:H6H3=TOCOL(INDEX(B4:D9,,MATCH(F3,B3:D3,0)),1)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,208
Messages
6,123,644
Members
449,111
Latest member
ghennedy

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