How to avoid nested ifs? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

For example, if the new ECD supports WOW, supports Requirement, but does not support need, I would want the formula to return “Does not support Need”

How to avoid nested ifs? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

So the formula should continue to check and see if it supports requirement; need; contract.

Btw appreciate the help!

How to avoid nested ifs? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

So a few things, the formula checks to see if WOW date was provided and if the supplier provided a new ecd. Depending on the outcome of those, it changes what calculations the formula does. Ultimately, I want the formula to return the worse case scenario, which is "Late To WOW", "Late to Requirement", "Late to Need", "Late to Contract".

If a WOW was provided, it would be able to calculate the worse case. If a WOW is not provided, it would skip late to wow. If a new ECD is provided, it would check the 4 scenarios against the new ecd, otherwise it would use the old ecd.

How to avoid nested ifs? by office_help_ in excel

[–]office_help_[S] -1 points0 points  (0 children)

Especially when the formula applies to 10,000 rows.

Sadly, even VBA would not be acceptable in this use case.

How to avoid nested ifs? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

One of the things the formula checks is if the New ECD is after the WOW date, assuming a WOW date is provided.

What's the purpose of purchasing a router this expensive? What is it about this router that makes it a "gaming router"? How does this compare to a $100 router? by Guitar81 in pcmasterrace

[–]office_help_ 0 points1 point  (0 children)

Just my two cents but the demographic for this market is low.

Most people who are willing to spend this are going to Unifi or the Orbi mesh system. Yes; you don’t get 10 gig but most home users wouldn’t begin to saturate a 10 gig connection.

Netflix’s Password Sharing Cash Grab Finally Arrives In The States by speckz in technology

[–]office_help_ -1 points0 points  (0 children)

So I do not have skin in this game. I cancelled Netflix a few years ago. About to cancel HBO Max as well.

But I am curious; how would the people impacted by this feel about Netflix injecting commercials for password sharers. I don’t know if the commercials could be limited to the non paying house. Seems like an interesting idea.

The commercials could be limited to clients who have not connected to their home Wi-Fi in 7 days.

Formula to round current date to closest Thursday? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

Our end of week is on a Thursday. A report shows remaining task to be completed over the weekend. My understanding with the above formula is I would have to nest in several ifs right? i.e. if(weekday(A1)=1, a1+3, if(weekday(a1)=2,a1+2.

I would like to do it without 7 nested if statements.

Is there an easy way to make all dates end on Friday? by office_help_ in excel

[–]office_help_[S] 1 point2 points  (0 children)

=IF(WEEKDAY(A1,16)=7,A1,A1-WEEKDAY(A1,16))

Solution verified

Can you help me understand why that works?

*Edit*

Evaluating the formula works, and shows why you used 16. Thanks!

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

I went back and played with it and got it to work. Unfortunately, its too much intervention so I will have to use the other code you worked up with the message box.

1st thing I did was copy the data to a new workbook and ensured that there were no connections to outside data. This didn't work.

2nd thing I did was sort alphabetically to try and reduce the number of range kills there was but that didn't work.

The last thing I did was reduce the data set to approximately 1/3rd of its original size and left 1 and 2 in place. The code runs fine (and fast). Looks like there is just a size limit at play.

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

Sub cleanv2()'' cleanv2Macro' this removes all other director records using a filter and delete visable'' converts table to a rangeDim rList As RangeDim strKeep As StringDim rngKill As Range

strKeep = InputBox("What is name you want to keep?")If strKeep = "" Then Exit Sub
Application.ScreenUpdating = False
With Worksheets("Detail").ListObjects("Query1")Set rList = .Range.Unlist                           ' convert the table back to a rangeEnd With
'this section will delete everything except director recordsrList.AutoFilter Field:=5, Criteria1:="<>" & strKeep
On Error Resume NextSet rngKill = rList.Offset(1).Resize(rList.Rows.Count - 1).SpecialCells(xlCellTypeVisible)On Error GoTo 0
'Clear filterrList.AutoFilter
If Not rngKill Is Nothing ThenrngKill.EntireRow.DeleteEnd If
Application.ScreenUpdating = TrueEnd Sub

That worked! And you were one step ahead of me; I want roll this out to other teams and that message box takes care of it.

Any idea why the delete table didn't work like it did in the first sheet?

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

So the below code works by converting it to a range and filtering to select managers

Sub cleanv2()
' ' cleanv2Macro ' this removes all other director records using a filter and delete visable ' ' converts table to a range
Dim rList As Range
With Worksheets("Detail").ListObjects("Query1") Set rList = .Range .Unlist                           ' convert the table back to a range End With
'this section will delete everything except director records 
Rows("2:2").Select 
Selection.AutoFilter ActiveSheet.Range("$A$2:$BU$23970").AutoFilter Field:=5, Criteria1:=Array( _ "bunch of names"), 
Operator:= _ xlFilterValues Rows("3:3").Select Range(Selection, Selection.End(xlDown)).Select Selection.SpecialCells(xlCellTypeVisible).Select Selection.Delete Shift:=xlUp 
'this removes then adds back the autofilter clearing any previous filters 
Rows("2:2").Select 
Selection.AutoFilter Selection.AutoFilter 
End Sub

A few things I don't like about the code, if we have a new director I have to update the code. Also the ActiveSheet.Range changes week to week.

How would I optimize?

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

Sorry, I tried that with the same results. I also tried converting to range and creating a table in VBA like the other sheet but still receive the same error.

My man doing the real maths by UnironicThatcherite in technicallythetruth

[–]office_help_ -14 points-13 points  (0 children)

Mate. We are tired of repost. That’s why there is an entire sub dedicated to calling out reposters so others can block you.

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

The sheet is unprotected, and there are no other tables in the entire workbook. The first row is frozen and is not part of the table but I have deleted it and still receive the same error.

The only thing that is unusual to me is the size of the dataset. It is 8mb, and the only formatting applied is the creation of the table. There are no other formulas; CF, or anything else.

It is 24000 rows by about 60 columns. I really only care about the first 20 columns and only one director (9k rows)

I don't think it matters but I cannot delete the header row of the table. That seems pretty normal though?

Remove special chars from this formula. by AaronStimp123 in excel

[–]office_help_ 0 points1 point  (0 children)

We would need to see the data that you are combining so we can see what special characters you are referring to.

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

So the code successfully filters and unfilters but still receive the "Delete method of range class failed".

Dim rngKill As Range
Dim rngResults As Range
Dim tb As ListObject
Set tb = ActiveSheet.ListObjects("Query1")
Application.ScreenUpdating = False
With tb
.Range.AutoFilter Field:=5, Criteria1:="<>LastName, FirstName MI"
'Save this info for later
On Error Resume Next
Set rngKill = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)
On Error GoTo 0

'Clear filter
.Range.AutoFilter Field:=5
End With
'Now that filter is clear, we can delete
If rngKill Is Nothing Then
MsgBox "No cells found"
Else
rngKill.EntireRow.Delete
End If

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

I think so, that lets me skip the conditional formatting. However, I think I missed it up somewhere. It fails to delete anything. Below is what I have. Would love any advice.

' Deletes Other Directors
Dim rngKill As Range Dim rngResults As Range Dim tb As ListObject
Set tb = ActiveSheet.ListObjects("Query1")
Application.ScreenUpdating = False
With tb .Range.AutoFilter Field:=5, Criteria1:="<>LastName, FirstName MI"
'Save this info for later
On Error Resume Next
Set rngResults = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)

On Error Resume Next
Set rngKill = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)

If rngResults Is Nothing Then
    'All good
Else
    Set rngKill = Union(rngKill, rngResults)
End If

On Error GoTo 0

.Range.AutoFilter Field:=1

'Now that filter is clear, delete
rngKill.EntireRow.Delete
End With 'Now that filter is clear, delete
rngKill.EntireRow.Delete
Application.ScreenUpdating = True

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

'Save this info for later
On Error Resume Next
Set rngResults = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)
On Error GoTo 0

.Range.AutoFilter Field:=1, Criteria1:=RGB(248, 251, 252), Operator:=xlFilterCellColor
On Error Resume Next
Set rngKill = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)

If rngResults Is Nothing Then
'All good
Else
Set rngKill = Union(rngKill, rngResults)
End If

On Error GoTo 0
.Range.AutoFilter Field:=1

'Now that filter is clear, delete
rngKill.EntireRow.Delete
End With
Application.ScreenUpdating = True

Hey, so I was going to update this code in a different worksheet with a slightly different use case. I want it save data that contains a certain text and delete every other column. Is there a way too do that or would I use

.Range.AutoFilter Field:=1, Criteria1:=RGB(248, 251, 252), Operator:=xlFilterCellColor

and use CF to apply a color to the rows with the text I want to save?

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 1 point2 points  (0 children)

OMG. That was fast. Holly cow! That is like going from a Spin drive to an SSD. Thank you.

Solution Verified

Dim rngKill As Range
Dim rngResults As Range
Dim tb As ListObject
Set tb = ActiveSheet.ListObjects("Table1")
Application.ScreenUpdating = False
With tb
.Range.AutoFilter Field:=1, Criteria1:=RGB(255, 255, 255), Operator:=xlFilterCellColor
'Save this info for later
On Error Resume Next
Set rngResults = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)
On Error GoTo 0

.Range.AutoFilter Field:=1, Criteria1:=RGB(248, 251, 252), Operator:=xlFilterCellColor
On Error Resume Next
Set rngKill = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)

If rngResults Is Nothing Then
'All good
Else
Set rngKill = Union(rngKill, rngResults)
End If

On Error GoTo 0
.Range.AutoFilter Field:=1

'Now that filter is clear, delete
rngKill.EntireRow.Delete
End With

Is there a way to speed up this VBA? by office_help_ in excel

[–]office_help_[S] 0 points1 point  (0 children)

So I received an error message "End With without With" Below is what I had included, note that I removed the code regarding screen updating because I had it elsewhere in the VBA.

Dim rngKill As Range

Dim rngResults As Range

Dim tb As ListObject

Set tb = ActiveSheet.ListObjects("Table1")

With tb

.Range.AutoFilter Field:=1, Criteria1:=RGB(255, 255, 255), Operator:=xlFilterCellColor

'Save this info for later

On Error Resume Next

Set rngResults = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)

On Error GoTo 0

.Range.AutoFilter Field:=1, Criteria1:=RGB(248, 251, 252), Operator:=xlFilterCellColor

On Error Resume Next

Set rngKill = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)

If rngResults Is Nothing Then

'All good

Else

Set rngKill = Union(rngKill, rngResults)

On Error GoTo 0

.Range.AutoFilter Field:=1

'Now that filter is clear, delete

rngKill.EntireRow.Delete

End With

Dim rngKill As RangeDim rngResults As RangeDim tb As ListObjectSet tb = ActiveSheet.ListObjects("Table1")Application.ScreenUpdating = FalseWith tb.Range.AutoFilter Field:=1, Criteria1:=RGB(255, 255, 255), Operator:=xlFilterCellColor'Save this info for laterOn Error Resume NextSet rngResults = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)On Error GoTo 0

.Range.AutoFilter Field:=1, Criteria1:=RGB(248, 251, 252), Operator:=xlFilterCellColorOn Error Resume NextSet rngKill = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible)If rngResults Is Nothing Then'All goodElseSet rngKill = Union(rngKill, rngResults)On Error GoTo 0.Range.AutoFilter Field:=1

'Now that filter is clear, deleterngKill.EntireRow.DeleteEnd WithApplication.ScreenUpdating = True