How to return the text that is in one column, in another column, ignoring zero values or blanks

Porcupine_

New Member
Joined
Jul 26, 2016
Messages
28
I have a column that has some cells filled with text, and some blank. I want to create a separate column that returns only the cells filled with text, ignoring blanks. I've shown what I mean in a table below. Is anyone able to help with this?

[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD]Column with data[/TD]
[TD]Return with formula [/TD]
[/TR]
[TR]
[TD]Text[/TD]
[TD]Text[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Text[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Text[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Thank you very much
 

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).
Assuming we are dealing with columns "A" and "B"
Here is a vba solution.

Code:
Sub My_Data()
'Modified 3-1-18 9:00 AM EST
Application.ScreenUpdating = False
Dim i As Long
Dim b As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
b = 1
    For i = 2 To Lastrow
        If Cells(i, 1).Value <> "" Then Cells(b, 2).Value = Cells(i, 1).Value: b = b + 1
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thank you - sorry I should have said - I want to avoid using a VBA solution, and just make it work with formulas - do you know if this is possible?
 
Upvote 0
Thank you - sorry I should have said - I want to avoid using a VBA solution, and just make it work with formulas - do you know if this is possible?

There may be a formula but if there is I do not know what it is.
I do more Vba then formulas.

Maybe someone else here at Mr. Excel will be able to help you.
 
Upvote 0
[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]a[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD][/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD][/TD]
[TD]c[/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TD]
[/TR]
[TR]
[TD]
52
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
53
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
54
[/TD]
[TD]j[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
55
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
56
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
57
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
58
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
59
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
60
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
61
[/TD]
[TD]k[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
62
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
63
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
64
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
65
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
66
[/TD]
[TD]l[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
67
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
68
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
69
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
70
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
71
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
72
[/TD]
[TD]m[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

B1=IFERROR(INDEX($A$1:$A$72,SMALL(IF($A$1:$A$72<>"",ROW($A$1:$A$72)-ROW($A$1)+1),ROWS($A$1:A1))),"")

control+shift+enter copy down
 
Upvote 0
That looks to be exactly what I need, but for some reason it isn't working. Would it be affected if the text in column A are coming via a formula?
 
Upvote 0
That looks to be exactly what I need, but for some reason it isn't working. Would it be affected if the text in column A are coming via a formula?

It works for me.
Put = in cell B1
Then paste in the formula
Then press Ctr+Shift+Enter

Then to continue down column just drag the cell down.
Do this by clicking on bottom right corner of cell with formula you should see a + appear and drag that down.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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