Remove blank rows when creating new sheet with formula

Jezza25

New Member
Joined
Jan 29, 2011
Messages
16
Hi All,


Firstly I understand I could filter and remove blank rows but in this instance for automation I actually need a formula


My data looks as follows, what I require is a formula so that it on a new sheet only shows the numbers if the cell has a number it will show the number, if the cell as shown in A4 and A5 are blank the following number will actually be what is in A6. Final result I am seeking is shown further below
Existing Sheet
1234
3232
4242
<Blank>
<Blank>
6435
2342
<Blank>
4535
<Blank>


New Sheet
1234
3232
4242
6435
2342
4535
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Formula in New Sheet A1 must be array entered with Cttl-Shift + Enter not just Enter and dragged down. Do you enter the curly brackets manually.

Excel Workbook
A
11234
23232
34242
4
5
66435
72342
8
94535
Existing Sheet



Excel Workbook
A
11234
23232
34242
46435
52342
64535
7
8
New Sheet
 
Upvote 0
Try this:
Will copy from Sheet(1) to Sheet(2)
Code:
Sub Auto_Filter()
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row

    With Worksheets("Sheet1").Range("A1:A" & Lastrow)
        
        .AutoFilter
        .AutoFilter Field:=1, Criteria1:="<> "
        .SpecialCells(xlCellTypeVisible).Copy Worksheets("Sheet2").Range("A1")
    End With
    
ActiveSheet.AutoFilterMode = False
End Sub
 
Upvote 0
Thanks you Firtstly what you supplied worked so thanks. I was meant to include 1 more thing but I could not edit. The reason for the formula is because if I go back to my original quastion the data extraction is showing orders and when someone order 2 things the order id is blank but the quantity still appears I also need a way of adding the quantity. SO for4 order id because there was 3 items I need the quantity to actualy show a total on the subsequant sheet of 74 ( 4 + 36 +_ 34)

Existing Sheet
ID Quantity
1234 54

3232 45
4242 4
<blank style="color: rgb(87, 65, 35); line-height: 15.99px;"> 36
<blank> 34
6435 3
2342 19
<blank> 23
4535 5</blank></blank></blank>


Next t


Formula in New Sheet A1 must be array entered with Cttl-Shift + Enter not just Enter and dragged down. Do you enter the curly brackets manually.

Existing Sheet

*A
11234
23232
34242
4*
5*
66435
72342
8*
94535

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


New Sheet

*A
11234
23232
34242
46435
52342
64535
7*
8*

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
A1{=IFERROR(INDEX('Existing Sheet'!$A$1:$A$9, SMALL(IF(ISBLANK('Existing Sheet'!$A$1:$A$9), "", ROW('Existing Sheet'!$A$1:$A$9)-MIN(ROW('Existing Sheet'!$A$1:$A$9))+1), ROW(A1))),"")}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Just on the above all the quanitties appear in the same column so it actually has the 36 under the 4
 
Upvote 0
On the Existing Sheet select the column with the order numbers - Ctrl + G - click special - put a checkmark in the blanks checkbox - click OK - press the = button then the up arrow button - Ctrl + Enter.

The gaps should now be filled in. Select the column and copy/paste as values.

On the new sheet

Array entered formula in A2 (Not A1) and dragged down. Sumif in B2 and dragged down.

Excel Workbook
AB
1123454
2323245
342424
4424236
5424234
664353
7234219
8234223
945355
Existing Sheet



Excel Workbook
AB
2123454
3323245
4424274
564353
6234242
745355
New Sheet
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,858
Members
449,194
Latest member
HellScout

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