Macro To Remove Rows That Contains The Phrase "Off Peak" And "Weekend"
Feb 27, 2009
I have a spreadsheet with about 20,000 lines. (The number of rows fluctuate) I need a macro to remove (delete) rows that contains the phrase "Off Peak" and "Weekend"
I was setting it up in a loop but I don't know how to make the loop end after ALL the "Off Peak" and "Weekend" info is removed.
My macro just does a find then delete the row and then loop to the find again. Is there an easier way and can the "Off Peak" and "Weekend" statements be combined into one search
Do While
Cells.Find(What:=" Off Peak", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Select
Selection.EntireRow.Delete
Loop
View 9 Replies
ADVERTISEMENT
Sep 4, 2009
I'm currently using the macro below to modify the two cells next to a date field in a template. The number of rows this will run through could vary from 2 to over 1 million, but the columns will always be the same. Because of the size of the datasets, this macro can run for quite a while, which is fine, but I'm thinking there's probably a better way to do it. To clarify, the object of this part of the macro is to determine if the date falls on a Saturday, and if so, change the value of the two cells to the right of the date to "0"
View 5 Replies
View Related
Nov 3, 2008
I need a macro that searches my spreadsheet for a keyword in Column B. If it finds the keywords (or an array of keywords would be even better), it then deletes the entire row above the keyword, the row with the keyword, and the row below the keyword.
So for example,
(Column B)
1 - Row Above
2 - Keyword Row
3 - Row Below
If the macro finds the text in column 2, it would delete 1, 2 and 3.
I need to have a second macro that performs a very similar function.
it copies the 3 rows (similar to the example below) to a different sheet based on the keyword.
View 3 Replies
View Related
Jan 26, 2014
I would like to write a macro which checks if phrase from column B (lets say 13845) can be found in column A cells.
For example DDH113845G389.
I think that it should be some kind of loop but I'm afraid I can't handle it.
View 6 Replies
View Related
Jun 8, 2007
I have a large keyword list in a sheet called "AllKWs" In ColA from A3 downwards).
What I'd like to be able to do is this, which I'm sure will be complicated, but I will explain.
Say keyword phrase sheet has 25,000 rows of data (could be more/could be less).
I click an assigned macro button.
A pop up box appears.
I type in a word or words I'd like some info on, so for example I type in a word or words like "car rent"
It then returns for me on a new sheet called "Multi Keywords" a lot of data on this sheet, which would hopefully be as follows:
All Row 1 will contain Column headings
All row 2 will contain Total Counts (I'll explain in a minute this row)
So, all data to be returned from Row 3 downwards.
OK, as to the data to be returned.
All returned data In all Columns to show data in descending order by No of occurrances/appearances
Col A (From A 3 downwards) = The actual number of 2 word appearances (In this example that contain the words "car rent"
In Col B = All 2 word Phrases Containing ("In this example "Car Rent")
(As a note, In this example, ColA (CellA3) could only show the number"1" and ColB (B3)could only show the phrase "Car Rent") once. (As there isn't no other possible combination).
In Col C =The actual number of 3 word appearances listed in descending order That
contain the word "Car rent"
In Col D =All 3 word Phrases Containing "Car Rent"
In Col E =The actual number of 4 word appearances containing "Car Rent" listed in descending order
In Col F =All 4 word Phrases Containing "Car Rent"
In Col G =The actual number of 5 word appearances listed in descending order
Actually if anyone can crack this I really do take my hat of to them.
OK,A few more points,
Cells B2,D2,F2,H2,J2,L2,N2,P2,R2, All contain the word "Total:" and if the macro can fill in the number as appropriate.
So for example Cell L2 (For 7 word phrases) would say something like "Total:42" (If in Col L From L3 downwards the macro found 42 7 word phrases that contained the words "Car rent"
Ok, Cells A2,C2,E2,G2,I2,K2,M2,O2,Q2 All these cells will contain the word "Total". So these cells would list the combined total number of occurrances of all the phrases.
So for example cell K2 might say "Occur:324" as the total number of occurances of 7 word phrases that had the words "Car rent"in.
OK. as an example, I will post a code that Jindon wrote for me sometime ago. I'm posting this now, as it is very similar in what I would like this macro to be able to do, and might help as I'm sure this 1 will be complicated. This 1 looks for a phrase, returns by No of occurrances etc, but for all the combinations (Word lengths) within the Keyword phrase list, rather than what I'm asking for now, which splits them into Number of words columns.
Here it is anyway:
Sub NicheKeywordFinder()
Dim a, dic As Object, X, myTxt As String, b(), c(), n As Long, i As Long, e, s, myTotal As Long
myTxt = InputBox("HuaHinCarRental - Niche Keyword Finder") 'change to suit
If Len(myTxt) = 0 Then Exit Sub
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = vbTextCompare
ReDim b(1 To Rows.Count, 1 To 1): ReDim c(1 To Rows.Count, 1 To 3)
With Sheets("All KWs") 'change to suit
a = .Range("a1", .Range("a" & Rows.Count).End(xlUp)).Value
End With
View 9 Replies
View Related
Jul 7, 2008
Create a smart macro which will remove all references to the #REF! which is left when rows are deleted. It would have to remove all trace of it from any equation it may be in (i.e. if it was in an averaging equation, it would need to remove the preceeding comma as well:
=average(a1,a2,!#REF!,a4 .........)
View 9 Replies
View Related
Mar 7, 2013
I am looking for a macro that will remove any rows exceeding 12 months. Each month new data is added in and I am looking to remove anything over 12 months with the new month is added.
View 6 Replies
View Related
Apr 30, 2014
I need to find the Peak and Trough for all the points in the attached graph and the data point used for plotting it. How do i find it.
Attached Image : b.png
Attached File : A1.xlsx
View 6 Replies
View Related
Aug 30, 2013
I had the following:
0.000%
-2.140%
-1.729%
0.973%
1.206%
1.469%
[code]...
I want to know the lowest number from the peak high to the lowest low was? If I have not explained that properly, if I had 12.00% as the highest and the next few rows consistently, and gradually moved to a low of 8.00% that would be a difference of -4.00%. So -4.00% would be my answer. formula as I need to know this one number in a column of 4000+ percentages like you see above.
View 9 Replies
View Related
Nov 8, 2013
In the attached spreadsheet I would like to locate the peak values of the numbers in column "F". I don't know if this is best done with a series of functions or by using a macro.
Column "F" translates to the light blue line on the attached chart. Column "F" (MACD) is the difference between a 12 week exponential moving average (EMA) and a 26 week EMA.
I would like the peak values from column "F" re-stated into column J,K,L or M. Ideally I would like to find the highest peak that occurred in a rolling 12 weak period. So not all peaks would need to be posted. By doing this I would only be identifying longer trends .
I'm using Excel 2007. 25 years experience using Excel and functions. Limited experience with Macros though long ago I used to write C code.
View 3 Replies
View Related
Aug 15, 2007
I have a sheet with alle days an date in one month
in column "A" the date (format: TTTT TT.MM.JJ)
in column "B" I have the worked hours
Below in the sheet I would to have to sums
each one for weekdays and weekends,
because my guys get more money if they work on a saturday or sunday.
I have been playing with the formulars
=sumif(weekdays(....., but cant geht the right thing
View 9 Replies
View Related
Feb 11, 2008
F4 has a macro calendar. I want, if a weekend is selected on the calendar, to display a message that only weekdays are allowed.
Here is the hard part. I have the Analysis ToolPak installed within Excel, but cannot import it into VBA as a reference. It will be in conflict with some of the code I have. It does not allow code in Workbook_Open to execute correctly. So I have to work around this.
Private Sub Calendar1_Click()
ActiveCell.Value = Calendar1.Value
Range("E4").Value = Evaluate("WEEKDAY(F4,2)")
If Range("E4").Value = (Monday-Friday) Then
Range("F5").Select
Unload Me
Else
Range("E4").Value = (Saturday or Sunday)
Range("F5").Select
MsgBox ("Please select a valid business day. Weekends and Holidays are invalid.")
Unload Me
End If
2 Things:
1. How do I list
Range("E4").Value = (1,2,3,4,5)
2. Is there a better way of doing this? As far as determining a weekend and displaying error message if it is.
View 9 Replies
View Related
Jan 8, 2010
If I have 1 Jan thru 31 Dec in A1 - A365, is there a way I can identify every weekend by placing 'X' in Col B alongside every occurrence of Saturday and Sunday?
View 2 Replies
View Related
Jan 19, 2010
I'm trying to divide the hours between 2 given times in blocks:
i.e.: monday 0600 - 1400 = 8 hrs
2400-0700 [mon - fri] = 1
0700-1800 [mon - fri] = 7
1800-2400 [mon - fri] = 0
0000-2400 [weekend]
I got the first 3 blocks working but got stuck with the 4th one.
It should count only those hours between saturday morning 0000 and sunday night 2400 if it concerns a weekend day. and actually these hours should not be calculated in the first 3 time blocks.
View 12 Replies
View Related
Nov 13, 2006
Is there a quick way to find weekend dates in excel? I tried pasting all 2006 dates into J2:J366 using the fill handle. It has weekdays as an option but not weekend dates. Any easy way (formula or simpler) to find the weekend dates in this range?
View 2 Replies
View Related
Nov 4, 2006
I'm doing a macro to get the last word in a phrase
View 7 Replies
View Related
Feb 6, 2014
I've got the following issue. I want to use the function =TODAY() + 2.
Because it's thursday 6-2 today, the outcome will be saturday 8-2.
The problem is that I want to exclude weekend in this formula, so the function must give monday 10-2 as the answer.
View 5 Replies
View Related
May 7, 2009
1 have figured out how to create an auto fill that is a mix of days in between. (When dates are not in a row.) For example, a schedule that starts a date, and then adds 2 days, then 1 day, then 3 days etc....it is for a tracking schedule. Once created those amounts are the same for for every row. The problem is, when it counts the next day, or 2 days or 3 days etc, it cannot include a weekend date, rather just 2 working days, or 3 working days etc.
Is this possible?
Right now, I start my first cell with a date, and go to the cell to the right, and in my formula, I type the previous cell address and I add (+) some value (2) to represent the day amount, but right now it includes the weekend days as well, and I need them skipped.
View 5 Replies
View Related
Jul 6, 2009
Please see attached Excel File.
I would like to calculate Column D depending on below criteria.
1. if both date is same than normal Column C-Column B.
2. if both date is not same than time diifrence should not be count after 17:30 to next day 08:30.
3. I do not want to include weekend (SAT & SUN) time diffrence if both date have.
In column D I have filled two cells that I want by formula.
View 11 Replies
View Related
Nov 28, 2013
I am attempting to create a rotating weekend work schedule in Excel to make life easier. There are 30 people who rotate Saturday's and Sunday's every month. Technically, they are only supposed to work 2 weekends a month, and am attempting a way to create this in Excel to make it more fair to the group instead of just picking and choosing which weekend these employees work, I would like an Excel program to do this for me.
View 1 Replies
View Related
Nov 6, 2013
How to calculate weekend (ONLY SUNDAY) in VBA.
View 3 Replies
View Related
Aug 3, 2009
I have a phrase in a listbox formated as such: "Company Name / Company ID # / City, State"
I need to be able to seperate the values out into seperate categories:
Company Name
Company ID #
City
State
Is there any way to do this within the code?
View 5 Replies
View Related
Mar 24, 2009
I have three columns.
Column 1: A list of items with a very long text description in each cell
Column 2: The Key phrase found within the long description in the cells of Column 1.
(The key phrase is different for each cell).
Column 3: Custom shortened description in text format.
Column 4: Formula to return the Custom shortened description, equivalent to the item in Column 1
How do I create a formula in Column 4 so that Excel searches for the Key phrase found within the string of Column 1 and returns the custom description in Column 4?
View 9 Replies
View Related
Nov 15, 2006
i have a list of information, and from that i want to extract a certain piece from that information and out it in a new cell...
eg. 'KLM00506', 'KLM00409-10', 'KLM00821-9' etc
as you can see, the info is not in the same length
what i need is to take out the FIRST 6 characters and have the remaining to be in a new cell
anyone has an excel formula that i can use ? not really interested in code, cause in this particular worksheet, everything is at its' place, no code required
View 4 Replies
View Related
Jun 29, 2014
I have a list of reports for many countries, I need to make sure each report is there for every country, except for weekend days.
report check.xlsx
View 1 Replies
View Related
Jun 24, 2014
I have to create VBA according to these criterias. I have a list of 22 rates that i need to distribute by order for a month period (30 days) noting that I need to skip weekends (Friday and Saturday)
Day 123.06.2014Monday20%
Day 224.06.2014Tuesday10%
Day 325.06.2014Wednesday7%
[Code]....
create this formula so that each time I change the date the rates are distributes accordingly
View 4 Replies
View Related
Apr 5, 2012
I need a formula that will give a warning if the date entered in cell is a weekend day.
View 2 Replies
View Related
Jan 17, 2014
I need to make a schedule for testing where I check the samples every 3 days but if that date hits on a weekend I want it to role over to the monday if it hits on a Sunday and Friday if it hits on a Saturday. In other words wait an extra day if it hits on a Sunday and check the sample a day early if it would normally be on a Saturday.
I have been playing around with the WORKDAY command and some of the other date functions but I can't figure this one out.
View 3 Replies
View Related
Jun 4, 2014
In the attachment, on the totals sheet I am doing a count of the results on Sheet2. Under "Alcohol as it Applies to Me" on Totals I am trying to count the 5 different categories, but the original question is a pick all that apply so at times there are multiple answers. I can't figure out the formula to count each phrase when there is multiple answers.
HRA Results.xlsx
View 2 Replies
View Related
May 14, 2014
I have a cell with a long list of phrases all separated by commas.
So it would appear, chicken, beef, steak, soup, fish
I want to create a rule in a cell to identify if one of those phrases comes up - so if chicken comes up then a 1 would appear.
To make it interesting is it possible to grab two words from the cell, so grab the words chicken and beef from a mass of words in one cell and bring it across.
I have these cells which contain huge amount of text and preferences and I am looking to identify these entities on if they contain these words.
View 2 Replies
View Related