Need Help : Creating Lists with IF Statements

Clockout

New Member
Joined
Dec 23, 2017
Messages
4
I want to start off by saying I'm suuper new to Excel and completely Self-taught mostly using these forum threads. I've hit a hitch lately and I need some assistance resolving my problem.

I work for a Front Desk in Las Vegas. And I'm trying to make a report that auto-sorts information from Delimited data. Currently I'm using this method:
Code:
=IF(MID('Data Drop'!M2,3,1)="0",'Data Drop'!M2,IF(MID('Data Drop'!M2,3,1)="1",'Data Drop'!M2,""))   AND     =IF(MID('Data Drop'!M2,3,1) = "6",'Data Drop'!M2,"")

This pulls the room number for a corresponding tower into two separate areas. However I do not want blank cells in between.

I don't know if that makes sense but this is what it looks like: https://imgur.com/a/jZX0B

I want to remove the blank cells, but I cannot filter them out since it affects all cells.
Perhaps I can do a IF statement that will generate a List for the true value?


Thank you for any help!
 
How about
Code:
Sub RoomsNumbers()
   
   Dim Cl As Range
   Dim Dsht As Worksheet
   Dim NxtRw As Long
   Dim NxtCol1 As Long
   Dim NxtCol2 As Long
   
   Set Dsht = Sheets("Data Drop")
   With Sheets("Today!!")
      NxtCol1 = 1
      NxtCol2 = 7
      For Each Cl In Dsht.Range("M2", Dsht.Range("M" & Rows.Count).End(xlUp))
         If Len(Cl.Value) = 5 Then
            Select Case Mid(Cl.Value, 3, 1)
               Case 0, 1
                  NxtRw = .Cells(Rows.Count, NxtCol1).End(xlUp).Offset(1).Row
                  If NxtRw > 30 Then
                     NxtCol1 = NxtCol1 + 2
                     NxtRw = .Cells(Rows.Count, NxtCol1).End(xlUp).Offset(1).Row
                  End If
                  .Cells(NxtRw, NxtCol1).Value = Cl.Value
               Case 6
                  NxtRw = .Cells(Rows.Count, NxtCol2).End(xlUp).Offset(1).Row
                  If NxtRw > 30 Then
                     NxtCol2 = NxtCol2 + 2
                     NxtRw = .Cells(Rows.Count, NxtCol2).End(xlUp).Offset(1).Row
                  End If
                  .Cells(NxtRw, NxtCol2).Value = Cl.Value
            End Select
         Else
            NxtRw = .Cells(Rows.Count, NxtCol2).End(xlUp).Offset(1).Row
            If NxtRw > 30 Then
               NxtCol2 = NxtCol2 + 2
               NxtRw = .Cells(Rows.Count, NxtCol2).End(xlUp).Offset(1).Row
            End If
            .Cells(NxtRw, NxtCol2).Value = Cl.Value
         End If
      Next Cl
   End With
End Sub
 
Last edited:
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,937
Members
449,480
Latest member
yesitisasport

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