Remove blank cells in a Row

JTL9161

Well-known Member
Joined
Aug 29, 2012
Messages
593
Office Version
  1. 365
Platform
  1. Windows
I have a row of data columns "B2" through "I2".
Not every cell in the in the row has data.

How would I show the same row elsewhere on the spreadsheet minus the blank cells.
So if cell B2-C2-E2-G2-I2 have data and D2-F2-H2 do not what is the (IFERROR(INDEX?) formula I need so only the B2-C2-E2-G2-I2 data show?


Thank you for your assistance.
James
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
How about
=IFERROR(INDEX($B2:$I2,AGGREGATE(15,6,(COLUMN($B2:$I2)-COLUMN($B2)+1)/($B2:$I2<>""),COLUMNS($L2:L2))),"")
Change the references to L to reflect the column with the formula
 
Upvote 0
Maybe like this as an array which got entered into M2:

=IFERROR(INDEX($B$2:$I$2, SMALL(IF($B$2:$I$2<>"", COLUMN($B$2:$I$2)-COLUMN($B$2)+1, ""), COLUMNS($M$2:M2))), "")
 
Upvote 0
Not sure if these are getting posted.

Need a VLOOKUP at the beginning of the above formula to read (for this example) cell L2 for data then look for that same data in cell a2...a10 then show the line it finds the data from columns B through I without blanks.
 
Upvote 0
That is completely different from your original question.
Can you please post some sample data showing what you have & what you are trying to get.
 
Upvote 0
Sorry, put the cart in front of the horse.

Cells A2 through A10 have codes (for this example) A2=ABC, A3=XYZ, A4=LMN with then the columns B through I with data but missing in random columns

for this each row. What I want to do is use the code above to remove the blank cells (which it does) but at the other spot on the spreadsheet Cell M2,M3,M4 I have the same ABC, XYZ, LMN. So I need a (Index) to look at cell M2 and then find that same name in the A2 through A10 cells then put the data across the B through I columns with no blanks.


A B C D E F G
1)ABC 555 666 777 888
2)XYZ 444 999 222

M2= ABC (so cells N2, O2, P2 & Q2) would look like below:

M2 N2 O2 P2 Q2
ABC 555 666 777 888


Hope this formats ok so you can understand
Thanks
 
Upvote 0
Ok, how about
=IFERROR(INDEX($B$2:$I$10,MATCH($M2,$A$2:$A$10,0),AGGREGATE(15,6,(COLUMN($B2:$I2)-COLUMN($B2)+1)/(INDEX($B$2:$I$10,MATCH($M2,$A$2:$A$10,0),0)<>""),COLUMNS($N2:N2))),"")
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
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