VBA Macro To Average Non-Contiguous But Regular Interval Cells?

Jun 8, 2013

I have a worksheet with 35,136 rows of data. I want to calculate the average of every 4th cell in the same column. Is there a way to create a macro to select every 4th cell in the average formula? If so, can I then substitute min and max for average?

View 1 Replies


ADVERTISEMENT

Average Non-Contiguous Cells & Multiply

Nov 22, 2007

I've tried hard to come up with a title as accurate as possible. Here is my problem:

I have six cells that need to be summed (N9,Q9,T9,W9,Z9,AC9). The sum of the cells needs to be multiplied by however many cells that have numerical data in them divided by 6. Assuming all cells in the range (N9,Q9,T9,W9,Z9,AC9) have the value of 50 the following rules would apply: ...

View 3 Replies View Related

Average Non-contiguous Cells & Exclude Zeros

Oct 10, 2007

I would like to average a non-continuous range of cells while also excluding all zeros.

I am averaging hours worked and the hours are found in cells:

B2, D2, F2, H2, J2, L2, N2

Some of these cells contain zeros at this time and I do not what to include the zeros in the average.

I have found formulas that would work but they are all with continuous cell ranges.

View 5 Replies View Related

Average Interval In Corresponding Data?

Feb 7, 2014

I have geological readings "W,X,Y & Z". For every drilled hole I have these readings recorded for individual intervals (i.e. 1-2m, 2-3m, etc.)

However, the intervals have now been grouped together based on other (unlisted) specifications.

Now I am tasked with averaging these readings "W,X,Y & Z" for the decided groupings. For example.... if intervals 1-4m have been grouped for the first hole, what is the average reading of "W,X,Y & Z" over this new interval?

I have attached a file which displays the layout of the spread. To the left is the original data, and in columns I:K are the new 'groupings' of intervals. Ideally, I would like to generate the average table to the right of the original data (highlighted in green).

So basically, I need some vba code to average the readings in the 1st table conditionally to correspond with the grouped intervals in the 2nd table.

View 1 Replies View Related

Macro: Copy Non-Contiguous Range Of Cells

Aug 24, 2008

I want to be able to copy cell D4, I4, G10, G12 etc from one spreadsheet and paste into another spreadsheet in the same locations as the source.
Is there a macro that will do this?

View 9 Replies View Related

Average Of Non-contiguous Column

Dec 24, 2008

I want to get the average of various non-contigous columns, ex:
Column B G X Z
10 0 6 8

However, I need to exclude any zero values. In this case the correct average is 8. I have used various sumif's and Average(IF) functions without success.

View 5 Replies View Related

Filter Column Data By Time Interval And Count Number Of Records For Each Interval?

Apr 28, 2014

I have a column of "timestamp" data (in mins) which i want to filter by a given time interval, say 10 mins. Then i want to count the number of records for each time interval and output the data to a sheet. how can i achieve this? through vba?

I attached a pic illustrating what i want to accomplish.

QQ截图20140429104406.png

View 1 Replies View Related

Can ActiveX Control Button Macro Be Placed In Regular Module

Feb 20, 2014

Can Active-X control button macro be placed in a regular module, or does it always have to reside in the sheet module?
Or is the only way to accomplish this is to have the macro in the regular module being called from the button macro in the sheet module?

I somehow seem to remember a way to move/assign an Active-X ControlButton macro to a regular module, but maybe I'm wrong?

View 1 Replies View Related

VB Macro To Run Multiple Macro In Time Interval

Jun 26, 2014

I have to run quite a few excel VB macro every morning one after the other.

I have to manually go thru each of them.

I need to create 1 VB macro which will run all macro after 1 min of interval in between.

Example:

Macro to run Sub Store1
Wait 1 min and then run Macro for Store2.
Macro to run Sub Store2
Wait 1 min and then run Macro for Store3.
Macro to run Sub Store3 and so on.

Below is the code I started with but not successful.

[Code] .....

View 2 Replies View Related

Macro To Make Backup For A File At Regular Intervals Without Opening It

Dec 19, 2012

Code to save a file C:DesktopFile.xls to a different path say F:New.xls as a backup.

I want this to happen every 1 hour so that if in case my original sheet File.xls is corrupted or deleted, I have a backup data (New.xls) which was last saved.

And also File.xls need not be necessarily open.

View 1 Replies View Related

Grouping Contiguous List Into Non-Contiguous Groups

Sep 9, 2006

I would like to be able to count the amount of entries in column C and depending on the amount group them in either groups of 3 or 4, all names would be unique...so if there are 14 names in the list they would need to be grouped in to two groups of 4 and two groups of 3, if there were 19 then 4 groups of 4 and 1 group of 3 etc to a maximum 50 people, the results could appearon a seperate worksheet say pasted on to the worksheet starting with the groups of 3 (so paste a group of 3 then skip 3 rows then paste groups of 4 skip 2 rows, the row skipping is to allow seperation and manual entry of extra data). There will never be groups of 5 or more and never less than 3

View 8 Replies View Related

Macro Code That Takes Average Of Next 24 Cells Down

Feb 4, 2013

I have this one query though in regards to loops.

I am trying to create a macro that can take the average of the the first 24 cells within a sheet, place the answer onto a cell in the next sheet (e.g. sheet2 in cell A1), then go back to the previous sheet, take the average of the next 24 cells within the sheet and paste the average of this new set in A2. I want to create a loop that will do this 365 times.

I have only managed to create the following code, however its only obtainning the average for the first set of 24 cells starting from B6 in sheet 1. I dont know how to use offsets that well....

VB:
Sub Oval1_Click()
For i = 1 To 365
Sheets("H1 - Riser Turret pressure").Select
Range("B4").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(Sheet1!R[2]C:R[25]C)"
Range("B4").Offset(1, 0).Select
Next i
End Sub

View 6 Replies View Related

Macro For Average Of Values - Dynamic Range Of Cells

Aug 1, 2013

I need to find average of the values , the count of the cells will be dynamic (may be 5 or even 200).

View 2 Replies View Related

Vlookup/Macro: Regions In Sheet2, Average Of Next 6 Cells

Mar 2, 2010

I am trying to write a macro do the folowing

1. Vlookup Regions in Sheet2 (eg. AP-Asia/Pasific)
2. Check which row they are in
3. then take the average of next 6 cells (AVERAGE 1,310, 6,744 etc..)

View 9 Replies View Related

Add AVERAGE Formulas To Cells Using Variables In Macro Code

Apr 15, 2008

I am trying to have the formula =( SUMIF(S2:S125,">0",S2:S125))/(COUNTIF(S2:S125,">0")) Put into cells through vba. What I did to get the formula is typed it into an excel cell to find the average of a group of cells that do contain blank cells. The formula brought out the proper results. So all I did is put the formula into vba and changed the appropriate parts. The range will not be the same of course, but there is what I have.

ActiveCell.Formula = "=(SUMIF(" & ActiveCell.Offset(orow + 2, 0).Address & ":" & ActiveCell.Offset(-1, 0).Address & ","">0""" & "," & ActiveCell.Offset(orow + 2, 0).Address & ":" & ActiveCell.Offset(-1, 0).Address & "))/(COUNTIF(" & ActiveCell.Offset(orow + 2, 0).Address & ":" & ActiveCell.Offset(-1, 0).Address & ","">0""" & "))"

When I show a msgbox for ActiveCell.Formula (Msgbox activecell.formula), it shows me the formula as above - =(SUMIF(S2:S125,">0",S2:S125))/(COUNTIF(S2:S125,">0")) Except instead of the s:ranges, it shows $L2:$L125 (which is correct). The quotes do show up around the criteria in both the sumif and countif. I keep receiving an error. I put a msgbox err.description & ", " err.number dialog in. The error comes up as ", 0" (no quotes).

View 2 Replies View Related

Colouring Non-contiguous Cells With VBA

Dec 4, 2012

I have a rather large database that I'm trying to automate colours in, based on data that is inserted into Column 'D'. I've used the following code (with some success), but it colours columns that I don't want to colour:

VB:
Sub KeyCellsChanged()
Dim Cell As Object
For Each Cell In Range("D1:D5000")

[Code].....

That works fine - but the problem I have is that I only want to colour columns A:N, Q, T, V, AB:AE, etc. (random columns and not always together). I have already tried to replace parts (as follows), but get all sorts of errors (in particular Run-time error 1004):

VB:
If Cell = "Rabbit" Then
Cell.Range("A:N,Q, T, V, AB:AE").Interior.ColorIndex = 42

Is there someway that a line of code can determin which cells to colour in the row, or alternatively code that will colour the columns a specific colour and make them stay that colour when the first code above is used?

View 3 Replies View Related

Min Value Excluding 0 For Non-contiguous Cells

Apr 2, 2009

I can find the min value excluding zero in a range of contiguous cells, but how can I do it if the cells are A1, A3, A25, A67, etc?

View 9 Replies View Related

Paste Into Non-Contiguous Cells

Dec 18, 2012

Copying and pasting into non-contiguous cells.

I want to be able to filter my data set, so for example I can filter column A for the value Berkshire, I then want to be able to select all the Berkshire's in Column A (not a problem, simply select them and copy), but I then need to be able to paste them into column B, so they appear in exactly the same rows as they do in Column A, but this doesn't work, it pastes them into hidden cells as well.

I've tried the Alt + ; (Visible Cells Only) option, followed by copy and paste and this makes no difference.

I have over 20,000 rows of data to filter, then copy the relevant cells and move to the same row in another column and currently I'm having to move the cells one by one which is ludicrous.

View 1 Replies View Related

Sort Non-contiguous Cells

May 24, 2006

How would I go about sorting a selection of non-contiguous cells?

View 5 Replies View Related

Clear Non-contiguous Cells

Jul 23, 2007

Am looking for routine that can be used to delete the contents of cells from multiple, non-contiguous cells throughout a single worksheet. I would like to place a "button" or some form of toggle-switch on the worksheet that will clear all entries at once. I see a thread "Macro Deleting Wrong Cells" that references a VBA sub-routine called "DelCells". I happen to be running Excel 2007 and am still adjusting to the new menu "structure" :-)

View 5 Replies View Related

Specify Non-Contiguous Cells With Variable Addresses

Nov 17, 2012

Excel VBA. I have a problem which is frustrating me almost beyond measure, but I am convinced that the answer is a simple one.

sub a() copies the values of 3 non-contiguous cells and pastes them as contiguous cells. This is simple as the cell addresses to be copied are absolute.

VB:
Sub a()
Dim x As Integer
x = 6
Range("A1,C1,E1").Copy
Cells(x, "H").PasteSpecial Paste:=xlPasteValues
End Sub

Sub b() copies a range of contiguous cells, including empty cells, and pastes them as contiguous cells, including empty cells. This is simple because I have specified a "range" of cells with variable addresses.

VB:
Sub b()
Dim x As Integer
Dim y As Long
x = 6
y = 1
Range("A" & y & ":E" & y).Copy
Cells(x, "H").PasteSpecial Paste:=xlPasteValues
End Sub

However, what I really want to do is copy 3 non-contiguous cells with variable addresses similar to sub b (ie. 'A' & y, 'C' & y, 'E' & y) and paste them as contiguous cells (without empty cells) as in sub a ().

What is the correct way to specify the cells to be copied?

View 8 Replies View Related

Find Highest Value In Non-contiguous Cells..

Oct 17, 2009

I have a cricket excel sheet that contains batsmans scores over a season. These scores are kept in non-contiguous cells for each game (ie. D5, J5, P5, V5 etc..) In the cell next to the score is an option for the user to enter an '*' to denote a not out score (these are in E5, K5, Q5, W5 etc.)

I can sort out a formula to find the highest score (from D5, J5, P5, V5) and place this high score in a cell elsewhere - but what I really need to do is to check if the high score is not out by looking to see if there is an asterisk in the adjacent cell, and then place the score AND asterisk in another cell.

View 3 Replies View Related

Copy Cells From Non-contiguous Selection?

Sep 12, 2013

If I select a group of non-contiguous cells with control shift is there any way that I can shift the same selection over to the next column. For example, I have A4 and A8 selected. When I press shift and right arrow it doesn't work.

View 4 Replies View Related

Conditionally Summing Non-contiguous Cells

Dec 11, 2006

Lets say I have values in A1, A3 and A5 and I want to to build either a sumif or an sum if array formula to conditionally sum them. How do I do this, assuming I don't want to use VBA or named ranges, i.e. create an array of noncontiguous cells and evalute & sum them.

View 9 Replies View Related

Export Non-Contiguous Column Cells

Feb 6, 2008

I have a spreadsheet with multiple columns. I need to save values from each specific column, but they are not non-contiguous, to a .txt or .csv file. In other words, I may need B:10, B15, B12, B25, etc. saved as one string in a text file. I have been working on this for about 15 hours and can't seem to get it to work.

View 9 Replies View Related

Copy Non-Contiguous Cells In Selection

Aug 9, 2006

I have a spreadsheet named PRODUCTS and in row A there are a bunch of product codes. I would like for the user to be able to use the CTRL and mouse to select all the products that they want and then once they push that button I would like it to paste the user selected cells into a sheet called Quote starting at A7.

View 4 Replies View Related

Copy Contiguous Cells & Paste To Every Second Row

Mar 13, 2008

I need to make the data in cells f4:f7 skip a row as shown in column D. How can I do this without doing a long and tedious cut and paste as I have over two years of data to reformat. Is there a code or some type of auto-format setting I could use?

View 3 Replies View Related

Non-contiguous Print Area Macro

Mar 18, 2009

I have a document which will require signatures after printed and want to keep the signature portion at the bottom of the page (currently rows 102-104). The problem is that the document will not need to be that long for every person and was wondering if it would be possible to have a macro that checks (C7:C:100), stops printing when it reaches the blank cells, and then prints those last 2 rows?

View 8 Replies View Related

Extend Non-contiguous Row Selection In Macro

Sep 16, 2008

I get 40~100 page PDFs of purchase orders every week. Each page has one part number and its open order and forecast information. Some pages have a few line of information, some have many lines.

I convert this file into a txt file.

I then create a macro to import it as space delimited and format it.

What I need to do it get rid of the header/footer information on EVERY page.

When the txt file is created it doesn't have any page marks.

The header has "ABC Widgets" as the customer name and then 10 rows of unnecessary information. If I do a Find ALL for "ABC Widgets" and select all, it will delete that header line at every instance, but the leftover selected cells then start not-lining up (meaning I can't just hit "delete row" 10 times and have it pick the right row--the rows don't line up any more and each instance is -1 row offset.)

Is there any way to extend the selection of non-contiguous rows (starting with ABC Widgets) down by 10 so I can delete them?

View 9 Replies View Related

Macro: Count Non-Contiguous Range

Dec 17, 2006

I'd like to count non blank cells in 16 separate ranges (each range consists of 6 consecutive cells). The first range in the series is C9:H9. 3 cells are then skipped and the process is repeated with the next range, ie L9:Q9 then skip 3. The last range in the series of 16 is therefore EK9:EP9.

If the value of non blank cells = 2 in any of these 16 ranges then copy the contents of this range to C24:D24 in sheet " Record Form Games 3583". If C24:D24 is not empty copy these values to C25:C26.

If the value of non blank cells = 6 in any of these 16 ranges then copy the contents of this range to C22:H22 in sheet "Record Form Games 3583". If C22 is not empty copy these values to C23:H23.

The ranges colored yellow in the example workbook are the ones that need to be copied to the sheet Record Form Games 3583.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved