Deleting blank cells

sebas35

New Member
Joined
May 24, 2019
Messages
3
Hi there,

Maybe this is an easy task for you guys, but I've been struggling with it. Basically, I need to converter the table 1 into the table 2.

Thank you for any help!



Table 1
A1 NO
A2YES
A3NO
A4YESNOYES
A5NOYES
A6YES YES
Table 2
A1NO
A2YES
A3NO
A4YESNOYES
A5NOYES
A6YESYES

<colgroup><col style="mso-width-source:userset;mso-width-alt:3868;width:82pt" width="109"> <col style="width:48pt" width="64" span="10"> <col style="mso-width-source:userset;mso-width-alt:3157;width:67pt" width="89"> </colgroup><tbody>
</tbody>
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If your cells are truly blank/empty then try...

Code:
Cells.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft

or manually

Select all cells
Ctrl + G
Click Special
Check Blanks
Ok
Right Click
Delete
Check Shift cells left
Ok
 
Last edited:
Upvote 0
If Table 1 appears just like your illustration with it starting in A1 cell (with "A1", etc. through "L1") and is in A1:L8,

Table 2 can be anywhere with the A column repeated (e.g., A8 to A13), then put this formula in B8 and fill across to L and down to row 13:

NOTE: It's an array formula, so you have to enter it using CTRL+SHIFT+Enter

Code:
=IFERROR(INDEX($B1:$L1,SMALL(IF($B1:$L1<>"",COLUMN($B1:$L1)-COLUMN($B1)+1),COLUMN()-1)),"")

HTH
 
Last edited:
Upvote 0
Hi kweaver,

Thank you for advising. Your formula worked only for one row in my matrix. Actually, I'd want the same procedure for every single row in the matriz (table 1) because my real matrix has about 2500 rows!

Thank you!
 
Upvote 0
Did you put the ARRAY formula in B8 and FILL across and down?

Clip0021.jpg
 
Upvote 0

Forum statistics

Threads
1,214,631
Messages
6,120,640
Members
448,974
Latest member
DumbFinanceBro

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