Pull data from column but skip if blank

at162

New Member
Joined
Nov 3, 2017
Messages
1
This one has me stumped so I thought I'd reach out for some help.

I have three columns of data like this:

[TABLE="width: 375"]
<colgroup><col style="width:93pt" width="125" span="3"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 125"]X[/TD]
[TD="class: xl65, width: 125"]0[/TD]
[TD="class: xl65, width: 125"]0
[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0
[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0
[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0
[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0
[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]Z
[/TD]
[/TR]
</tbody>[/TABLE]

The values X, Y, and Z are values which appear based on IF formulas and 0 when the conditions are not met.

What I'm looking to do is to be able to generate a separate table like this which skips any cells with a value of 0.

[TABLE="width: 375"]
<colgroup><col style="width:93pt" width="125" span="3"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 125"]X[/TD]
[TD="class: xl65, width: 125"]Y[/TD]
[TD="class: xl65, width: 125"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]Z
[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]Y
[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X
[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"]Y[/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"]Z[/TD]
[/TR]
[TR]
[TD="class: xl65"]X[/TD]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[/TR]
</tbody>[/TABLE]

I've searched around and tried everything that I know, but I am still stumped.

Anyone have any ideas?

Many thanks in advance!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi, welcome to MrExcel
Give this a try, changing the ranges to suit
Code:
Sub RemoveZero()

    Dim UsdRws As Long
    Dim usdCols As Long

    UsdRws = Range("G1").CurrentRegion.Rows.Count
    usdCols = Range("G1").CurrentRegion.Columns.Count
    Range("L1").Resize(UsdRws, usdCols).Value = Range("G1").CurrentRegion.Value
    With Range("L1").CurrentRegion
        .Replace 0, "", xlWhole
        .SpecialCells(xlBlanks).Delete xlUp
    End With

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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