Excel Formula Question

Mjsherwin

New Member
Joined
Jul 24, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to get a formula (so that there is no need for manual intervention on the part of the user) to format the below example that is contained in 1 Column of data.

What I currently have:

A
B
(Blank Cell)
C
D

What I'm getting:

A
B
C
C
D

What I want to get:

A
B
C
D
(Blank Cell)

Essentially, if the cell is blank then I want the value returned to be the next cell below it unless there are 2 blank cells & then just return a blank. Also, the data points cannot repeat themselves. If anyone could point me in the right direction I'd greatly appreciate it. Thank you
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Mjsherwin let's get the ball rolling. Now this VBA program is really basic. Maybe some of the A Students will weigh in and come up with a 2 line program. But until then, this should get the conversation going. Also this should generate more questions than answers but we have to start some place.

VBA Code:
Sub Delete2()

Dim LastRow As Long
Dim Steps As Long
Dim Trap As Boolean

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

Cells(LastRow, 1).Select

Trap = True
For Steps = LastRow To 1 Step -1

Cells(Steps, 1).Select
If ActiveCell <> "" And Trap = False Then
Trap = True
End If

If ActiveCell = "" And Trap = True Then
Rows(Steps).Delete
Trap = False
End If

If ActiveCell = ActiveCell.Offset(1, 0) Then
Rows(Steps).Delete
End If

Next Steps
End Sub

So here is an example of the data.

delete 1.xlsm
A
1A
2B
3
4C
5D
6
7
8E
9F
10G
11G
12
13
14H
15I
16
17J
Delete row
 
Upvote 0
If it's only 1 column of data ....How about this
  • Highlight your column
  • Press F5 to bring the "Go to" dialog.
  • In the dialog box click the Special… button.
  • In the "Go to special" dialog, choose "Blanks" radio button and click OK.
  • Right-click on any selected cell and select "Delete…".
  • In the "Delete" dialog box, choose "Entire row" and click Entire row.

 
Upvote 0
I'm trying to get a formula... to format the below example that is contained in 1 Column of data.
Welcome to the MrExcel board!

Do you mean like this?

21 07 25.xlsm
AB
1AA
2BB
3C
4CD
5D
6
Remove blanks
Cell Formulas
RangeFormula
B1:B4B1=FILTER(A1:A10,A1:A10<>"","")
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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