VBA Loop through rows with multiple ranges and conditions - excel

Disclaimer: New to VBA
I have an Excel sheet where I would like to build a VBA that does the following things.
My requirement is to fill a value in row Z based on a formula determined by the text in row M.
The formula deals with summing values from row A, B, C in different combinations (determined by text in row M).
Loop this for each row starting from row 5 to row 10000.
Eg:
If cell M5 = Apple, then Z5 = A5+B5;
If cell M9 = Samsung, then Z9 = C9+A9
I know a nested IF formula does it easily but there are just too many conditions and I'm looking for an automatic and cleaner route.
Thanks!

Not a VBA, but I think this will solve the issue:
The solution requires two parts:
a) A table (or named range) to hold the string value to match, and two columns to be added. This table (BrandEq - my example) is essentially a map to indicate which cells are to be summed. Where the column (A,B,C,...) is followed by a '#" for the row to be added in later.
b) A custom formula (detailed below) in each cell (z, in your case) to return the sum of the appropriate columns.
[Please see the attached image]
Personally, I prefer tables, but either that or a named range is recommend because additional "brands" and combinations (Cell1,Cell2) (my example) can be added easily and the formula automatically updates, so no going back to the base formula.
The the "z cell" formula is:
=INDIRECT(SUBSTITUTE(VLOOKUP(Sheet1!$D15,BrandEq,2,FALSE),"#",TEXT(ROW(),"#####"))) +INDIRECT(SUBSTITUTE(VLOOKUP(Sheet1!$D15,BrandEq,3,FALSE),"#",TEXT(ROW(),"#####")))
This may be easier to understand working from the 'inside-out':
VLOOKUP (from the 'DATA' table/range- current row brand column,into the 'BRANDEQ' table/range, return the contents of the corresponding column - note 2 on the first line and 3 on the second line, FALSE=exact matches on the lookup value)
with this value (eg. a#) ->
SUBSTITUTE( the hashtag '#' place holder, with the current row() as a text() value)
Indirect( return the corresponding value of that cell -- from the data table, the formula is entered in 'zval' row 14 (my example) (eg. 'a#' -> a11 = 100)
This formula is called a second time, but this time returning the 'Cell2 value, all else is the same function. (eg. 'b#' ->b11 = 15)
The results are added together.
Row 11, for example, parses as follows:
INDIRECT(SUBSTITUTE(VLOOKUP(Sheet1!$D11,BrandEq,2,FALSE),"#",TEXT(ROW(),"#####")))
+
INDIRECT(SUBSTITUTE(VLOOKUP(Sheet1!$D11,BrandEq,3,FALSE),"#",TEXT(ROW(),"#####")))
INDIRECT(SUBSTITUTE(VLOOKUP('Apple',BrandEq,2,FALSE),"#",TEXT(14,"#####")))
+
INDIRECT(SUBSTITUTE(VLOOKUP('Apple',BrandEq,3,FALSE),"#",TEXT(14,"#####")))
INDIRECT(SUBSTITUTE("a#","#","11")) + INDIRECT(SUBSTITUTE("b#","#","11"))
INDIRECT("a11") + INDIRECT("b11")
100 + 15
115
If additional/different cells need to be reference they only need be included in the 'BrandEQ' Table. Note: the cells be referenced do not need to be contiguous - they can be spread throughout the row.

Related

How to make a drop down list with conditions? [duplicate]

I want the following in Excel:
Two dropdown lists in adjacent cells:
Dropdown list #1 | Dropdown list #1
Dropdown list 1:
One
Two
Three
If I select One in the first cell, the list in the second cell should contain these choices:
One:
1.1
1.2
1.3
If I select Two in the first cell, the list in the second cell should contain these choices:
Two:
2.1
2.2
2.3
And so on. There are a lot of tutorials around, but I'm having some hassle figuring out which of them addresses this exact question.
Update: An example. When selecting f.ex. Group 1 under the Group heading (col A), the entries listed under Group 1 to the right (col D) should appear under the Item heading (col B). And the same for the other Groups.
Update as promised:
When you're using a List for validation, you have to input a range as shown below.
The OFFSET function allows to to dynamically set a range based on its input criteria.
If you consider this:
=OFFSET(C1,0,0,1,1)
Argument 1 = Anchor cell
Argument 2 = Number of rows to move, you can use minus number here to move rows up and positive numbers to move down
Argument 3 = Number of columns to move. Negative is left, positive to the right.
Argument 4 = Height of the range (can't be negative and is optional, default is 1)
Argument 5 = Width of the range (can't be negative and is optional, default is 1)
In this instance, the range returned would be C1 as we have no row or column offset and height and width is set to 1
The MATCH function will return an index of where a value appears in a range of cells (range must be either 1 cell wide or 1 cell high)
Based on the above screen print =MATCH("Group2",D1:F1,0) will return 2, as "Group2" appears in the second cell in the D1:F1 range. ("Group1" would return 1, "Group3" would return 3, and "Group4" would return #N/A as it doesn't exist).
So based on that we can put the MATCH function in as our 2nd argument in the OFFSET function, and pick the column that matches the first argument in the MATCH function.
=OFFSET(C1,0,MATCH("Group2",D1:F1,0),1,1) will return back range E1 as we've shifted the columns by 2 from C1 because of the MATCH
=OFFSET(C1,1,MATCH("Group2",D1:F1,0),3,1) will now return back E2:E4 as we've increased the height of the range to 3 and the row offset to 1.
And finally we can change the "Group2" value in the MATCH function to a cell value that will mean the range will dynamically change.
Here I've used Cell A2 =OFFSET(C1,1,MATCH(A2,D1:F1,0),3,1) so whatever value is in cell A2 will be used to offset the range.
And the last thing to do is to put the dynamic range into the validation (I used B2)
This will dynamically set the validation range.
When I'm using OFFSET function with multiple arguments and I'm not sure that it's returning back the right range, I wrote a small helper User Defined Function that I just put in a VBA module.
Public Function GetAddress(rng As Range) As String
GetAddress = rng.Address
End Function
This allows me to put the offset formula in and it will return back the range address. So I can make sure it's right.
There may be a built in function for this, but I've never found it.
This solution avoids the use of the volatile OFFSET function.
For the first Data Validation located at A2 use this formula:
=$D$1:$F$1
For the second Data Validation located at B2 use this formula:
= INDEX( $D$2:$F$4, 0, MATCH( $A$2, $D$1:$F$1, 0 ) )
The second formula uses the value selected from the data Validation in A2 to MATCH the corresponding column in D1:F1 and applies the column number to the INDEX function to return the whole column in range D2:F4.
The function INDEX( reference, row number, column number ) returns the entire column or row of the referenceby entering 0 as the row number or column number respectively.

Excel Index to look up multiple values

I have a small data set of 2 columns and several rows (columns A and B)
I want to return each instance of codeblk 3 in a formula that is elsewhere in my sheet, (so a vlookup is out as it only shows the first instance) if it does not appear then a message to say its not there should come up.
I have the formula partially working but i cant see the reason why its not displaying the values.
My formula is as below:
This is an array
{=IF(ISERROR(INDEX($A$55:$B$70,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)),ROW(1:1))-1,1)),"No value's produced",INDEX($A$2:$C$7,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)),ROW(1:1))-1,1))}
The result that shows up is only "No values produced" but it should reflect statement B, C and D in 3 separate cells (when changing ROW(1:1), ROW(2:2) etc)
{=SMALL(IF($B$56:$B$69=4,ROW($B$56:$B$69)),ROW(1:1))} - This produces the result 68 which is the correct row.
Any ideas?
Thanks,
This is an array formula - Validate the formula with Ctrl+Shift+Enter while still in the formula bar
=IFERROR(INDEX($A$55:$B$70,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)-54),ROW(1:1)),1),"No value's produced")
The issue you are facing is that your index starts it's first row on $B$55, you need to offset the row numbers in the array to reflect this. For example, the INDEX contains 16 rows but if you had a match on the first row you are asking for the 55th row from that INDEX(), it just can't fulfil that.
EDIT
The offset was out of sync as your original formula included another -1 outside of the IF(), I also left an additional bracket in play (the formula above has now been edited)
The ROW() function will essentially translate $B$55:$B$70 into ROW(55:70) which will produce the array {55;56;57;58;59;60;61;62;63;64;65;66;67;68;69;70} so the offset is needed to translate those row numbers in to the position they represent in the indexed data of INDEX().
The other IF() statement then produces and array of {FALSE;2;3;4;FALSE etc.
You can see these results by highlighting parts of the formula in the formula bar and hitting F9 to calculate.

Is there a 2 Value Look up function in MS Excel that can perform the following?

I am going crazy over this. It seems so simple yet I can't figure this out. I have two worksheets. First worksheet is my data. Second is like an answer key. Upon checking checking, A1:B1 in Sheet 1 is a match with the conditions in Row 52 in SHEET 2, therefore, the value in Column C is "MGC". What is the formula that will perform this function? It's really hard to explain without the data so I pasted a link of the sample spreadsheet. Thank you so much in advance.
sample spreadsheet here. https://docs.google.com/spreadsheets/d/1_AjuNfCdGfEM-XkqPa6W4hSIxQg4NM2Vg4c2C1pQ_vQ/edit?usp=sharing
screenshot here. (wont let me post i have no reputation)
In Sheet2, insert a column in front of Column A and put the formula in A2 =C2&D2.
Then in Sheet1, Cell C2 the formula =vlookup(A2&B2,Sheet2!A:B,2,0).
the first make a concatenated key to lookup, then the second looks up that key.
How about a index(match())? If I've understood correctly you need to match across both the A and B column in sheet one, checking for the relevant values in B and C on sheet 2 to retrun worksheet 2 column a to worksheet 1 column c.
third version try:
=INDEX(Sheet2!$C$1:$C$360,MATCH(Sheet1!A1&Sheet1!B1,Sheet2!$B$1:$B$360&Sheet2!$C$1:$C$360,0))
Basically what this does is use concatenation, the & operator, to specify you are looking for "Criteria A" & "Criteria B" in sheet 1, which makes the string "Criteria A Criteria B", which is supplied in the first part of the match function.
In the second it then says match this against all of my variables in sheet 2 in the same way with concantenation.
The final part of match function (0) specifies you want an 'exact' match
It then supplied this as a reference to the index function, which then finds the row intersecting with the value you want, and returns that.
As noted here https://support.microsoft.com/en-us/kb/59482 this is an array formula, so it behaves differently, and must be input differently. https://support.office.com/en-za/article/Guidelines-and-examples-of-array-formulas-7d94a64e-3ff3-4686-9372-ecfd5caa57c7
There are (at least) 2 ways you could do this without VBA.
USING A SORTED LIST
The first relies on the assumption that your data can be re-sorted, so that everything "Unreported" is in the top, and everything "reported" is together below that (or vice versa). Assuming that this is the case (and it appears to already be sorted like this),we will use the function OFFSET to create a new range which shows only the values that align with either being "Unreported" or "Reported".
Offset takes a given reference to a point on a sheet, and then moves down/up & left/right to see what reference you want to return. Then, it returns a range of cells of a given height, and a given width. Here, we will want to start on Sheet2 at the top left, moving down until we find the term "Unreported" or "Reported". Once that term is found, we will want to move one column to the right (to pull column B from sheet 2), and then have a 'height' of as many rows as there are "unreported" or "reported" cells. This will look as follows in A1 on sheet 1, copied down:
=OFFSET(Sheet2!$A$1,MATCH(A1,Sheet2!A:A,0)-1,1,COUNTIF(Sheet2!A:A,A1),1)
This says: First, start at cell A1 on sheet2. Then find the term in A1 (either "unreported" or "reported", on sheet2!A:A (we subtract 1 because OFFSET starts at A1 - so if your data starts at A1 we need to actually stay at "0". If you have headers on sheet2, you will not need this -1). Then, move 1 column to the right. Go down the rows for as many times as Sheet2 column A has the term found in Sheet1 A1. Stay 1 column wide. Together, this will leave you with a single range on sheet2, showing column B for the entire length that column A matches your term in sheet1 A1.
Now we need to take that OFFSET, and use it to find out when the term in Sheet1 B1 is matched in Sheet2 column B. This will work as follows:
=MATCH(B1,[FORMULA ABOVE],0)
This shows the number of rows down, starting at the special OFFSET array created above, that the term from B1 is matched in column B from sheet2. To use this information to pull the result from column C on sheet 2, we can use the INDEX function, like so:
=INDEX([FORMULA ABOVE],MATCH(B1,[FORMULA ABOVE],0))
Because this would be fairly convoluted to have in a single cell, we can simplify this by using VLOOKUP, which will only require the OFFSET function to be entered a single time. This will work as follows:
=VLOOKUP(B1,[FORMULA ABOVE],2,0)
This takes the OFFSET formula above, finds the matching term in B1, and moves to the 2nd column to get the value from column C in sheet2. Because we are going to use VLOOKUP, the offset formula above will need to be adjusted to provide 2 columns of data instead of 1. Together, this will look as follows:
FINAL FORMULA FOR SHEET1, C1 & COPIED DOWN
=VLOOKUP(B1,OFFSET(Sheet2!$A$1,MATCH(A1,Sheet2!A:A,0)-1,1,COUNTIF(Sheet2!A:A,A1),2),2,0)
OPTION USING ARRAY FORMULAS
The above method will only work if your data is sorted so that the REPORTED and UNREPORTED rows are grouped together. If they cannot be sorted, you can use an ARRAY FORMULA, which essentially takes a formula which would normal apply to a single cell, and runs it over an entire range of cells. It returns an array of results, which must be reduced down to a single value. A basic array formula looks like this [assume for this example that A1 = 1, A2 = 2...A5 = 5]:
=IF(A1:A5>3,A1:A5,"")
Confirm this (and all array functions) by pressing CTRL + SHIFT + ENTER, instead of just ENTER. This looks at each cell from A1:A5, and if the value is bigger than 3, it gives the number from that cell - otherwise, it returns "". In this case, the result would be the array {"";"";"";4;5}. To get the single total of 9, wrap that in a SUM function:
=SUM(IF(A1:A5>3,A1:A5,""))
In your case, we will want to use an array formula to see what row in Sheet2 matches A1 from Sheet1, and B1 from Sheet1. This will look like this:
=IF(Sheet2!$A$1:A$100=A1,IF(Sheet2!$B$1:$B$100,ROW($B$1:$B$100),""),"")
This checks which rows in column A from sheet 2 match A1. For those that do, it then checks which rows in column B from sheet 2 match B1. For those, it pulls the row number from that match. Everything else returns "". Assuming no duplicates, there should only 1 row number which gets returned. To pull that number from the array of results, wrap the whole thing in a MATCH function. Now that you have the row number, you can use an INDEX function to pull the result in Column C with that row, like this:
FINAL ARRAY FORMULA METHOD
=INDEX($C$1:$C$100,MAX(IF(Sheet2!$A$1:A$100=A1,IF(Sheet2!$B$1:$B$100,ROW(Sheet2!$B$1:$B$100),""),"")))
Remember to confirm with CTRL + SHIFT + ENTER instead of just ENTER, when you type this formula. Note that I didn't refer to all of Sheet2!A:A, because array formulas run very slowly over large ranges.
The following formula should work without making any changes to the datasheets.
=INDEX(Sheet2!$A$1:$A$360,MATCH(Sheet1!A1,IF(Sheet2!$C$1:$C$360=Sheet1!B1,Sheet2!$B$1:$B$360),0))
Remember to save this formula as an array with CTRL+SHIFT+ENTER
Documentation on how to use INDEX and MATCH against multiple criteria can be found on Microsoft Support.
It's not clear what you want to do with the multiples that do not have corresponding matches. txed is listed as Unreported twice in Sheet1; kntyctap is listed as Unreported three times. There are only one corresponding match on Sheet2 for each of these.
Non-array Standard Formulas for multiple criteria matches
For Excel 2010 and above use this standard formula in Sheet1!C1:
=IFERROR(INDEX(Sheet2!$A$1:$A$999,AGGREGATE(15,6,ROW(1:999)/((Sheet2!$B$1:$B$999=A2)*(Sheet2!$C$1:$C$999=B1)), COUNTIFS(A$1:A1, A1, B$1:B1, B1))), "")
For version of Excel prior to 2010 use this standard formula in Sheet1!C1:
=IFERROR(INDEX(Sheet2!$A$1:$A$999, SMALL(INDEX(ROW($1:$999)+((Sheet2!$B$1:$B$999<>A1)+(Sheet2!$C$1:$C$999<>B1))*1E+99, , ), COUNTIFS(A$1:A1, A1, B$1:B1, B1))), "")
I've handled error with the IFERROR function in that latter formula. Excel 2003 and previous may have to use an IF(ISERROR(..., ...)) combination.

Excel: Dropdown list dependant on other dropdown list

I want the following in Excel:
Two dropdown lists in adjacent cells:
Dropdown list #1 | Dropdown list #1
Dropdown list 1:
One
Two
Three
If I select One in the first cell, the list in the second cell should contain these choices:
One:
1.1
1.2
1.3
If I select Two in the first cell, the list in the second cell should contain these choices:
Two:
2.1
2.2
2.3
And so on. There are a lot of tutorials around, but I'm having some hassle figuring out which of them addresses this exact question.
Update: An example. When selecting f.ex. Group 1 under the Group heading (col A), the entries listed under Group 1 to the right (col D) should appear under the Item heading (col B). And the same for the other Groups.
Update as promised:
When you're using a List for validation, you have to input a range as shown below.
The OFFSET function allows to to dynamically set a range based on its input criteria.
If you consider this:
=OFFSET(C1,0,0,1,1)
Argument 1 = Anchor cell
Argument 2 = Number of rows to move, you can use minus number here to move rows up and positive numbers to move down
Argument 3 = Number of columns to move. Negative is left, positive to the right.
Argument 4 = Height of the range (can't be negative and is optional, default is 1)
Argument 5 = Width of the range (can't be negative and is optional, default is 1)
In this instance, the range returned would be C1 as we have no row or column offset and height and width is set to 1
The MATCH function will return an index of where a value appears in a range of cells (range must be either 1 cell wide or 1 cell high)
Based on the above screen print =MATCH("Group2",D1:F1,0) will return 2, as "Group2" appears in the second cell in the D1:F1 range. ("Group1" would return 1, "Group3" would return 3, and "Group4" would return #N/A as it doesn't exist).
So based on that we can put the MATCH function in as our 2nd argument in the OFFSET function, and pick the column that matches the first argument in the MATCH function.
=OFFSET(C1,0,MATCH("Group2",D1:F1,0),1,1) will return back range E1 as we've shifted the columns by 2 from C1 because of the MATCH
=OFFSET(C1,1,MATCH("Group2",D1:F1,0),3,1) will now return back E2:E4 as we've increased the height of the range to 3 and the row offset to 1.
And finally we can change the "Group2" value in the MATCH function to a cell value that will mean the range will dynamically change.
Here I've used Cell A2 =OFFSET(C1,1,MATCH(A2,D1:F1,0),3,1) so whatever value is in cell A2 will be used to offset the range.
And the last thing to do is to put the dynamic range into the validation (I used B2)
This will dynamically set the validation range.
When I'm using OFFSET function with multiple arguments and I'm not sure that it's returning back the right range, I wrote a small helper User Defined Function that I just put in a VBA module.
Public Function GetAddress(rng As Range) As String
GetAddress = rng.Address
End Function
This allows me to put the offset formula in and it will return back the range address. So I can make sure it's right.
There may be a built in function for this, but I've never found it.
This solution avoids the use of the volatile OFFSET function.
For the first Data Validation located at A2 use this formula:
=$D$1:$F$1
For the second Data Validation located at B2 use this formula:
= INDEX( $D$2:$F$4, 0, MATCH( $A$2, $D$1:$F$1, 0 ) )
The second formula uses the value selected from the data Validation in A2 to MATCH the corresponding column in D1:F1 and applies the column number to the INDEX function to return the whole column in range D2:F4.
The function INDEX( reference, row number, column number ) returns the entire column or row of the referenceby entering 0 as the row number or column number respectively.

Copy every nth line from one sheet to another

I have an Excel spreadsheet with 1 column, 700 rows. I care about every seventh line. I don't want to have to go in and delete the 6 rows between each row I care about. So my solution was to create another sheet and specify a reference to each cell I want.
=sheet1!a1
=sheet1!a8
=sheet1!a15
But I don't want to type in each of these formulas ... `100 times.I thought if I selected the three and dragged the box around, it would understand what I was trying to do, but no luck.
Any ideas on how to do this elegantly/efficiently?
In A1 of your new sheet, put this:
=OFFSET(Sheet1!$A$1,(ROW()-1)*7,0)
... and copy down. If you start somewhere other than row 1, change ROW() to ROW(A1) or some other cell on row 1, then copy down again.
If you want to copy the nth line but multiple columns, use the formula:
=OFFSET(Sheet1!A$1,(ROW()-1)*7,0)
This can be copied right too.
In my opinion the answers given to this question are too specific. Here's an attempt at a more general answer with two different approaches and a complete example.
The OFFSET approach
OFFSET takes 3 mandatory arguments. The first is a given cell that we want to offset from. The next two are the number of rows and columns we want to offset (downwards and rightwards). OFFNET returns the content of the cell this results in. For instance, OFFSET(A1, 1, 2) returns the contents of cell C2 because A1 is cell (1,1) and if we add (1,2) to that we get (2,3) which corresponds to cell C2.
To get this to return every nth row from another column, we can make use of the ROW function. When this function is given no argument, it returns the row number of the current cell. We can thus combine OFFSET and ROW to make a function that returns every nth cell by adding a multiplier to the value returned by ROW. For instance OFFSET(A$1,ROW()*3,0). Note the use of $1 in the target cell. If this is not used, the offsetting will offset from different cells, thus in effect adding 1 to the multiplier.
The ADDRESS + INDIRECT approach
ADDRESS takes two integer inputs and returns the address/name of the cell as a string. For instance, ADDRESS(1,1) return "$A$1". INDIRECT takes the address of a cell and returns the contents. For instance, INDIRECT("A1") returns the contents of cell A1 (it also accepts input with $'s in it). If we use ROW inside ADDRESS with a multiplier, we can get the address of every nth cell. For instance, ADDRESS(ROW(), 1) in row 1 will return "$A$1", in row 2 will return "$A$2" and so on. So, if we put this inside INDIRECT, we can get the content of every nth cells. For instance, INDIRECT(ADDRESS(1*ROW()*3,1)) returns the contents of every 3rd cell in the first column when dragged downwards.
Example
Consider the following screenshot of a spreadsheet. The headers (first row) contains the call used in the rows below.
Column A contains our example data. In this case, it's just the positive integers (the counting continues outside the shown area). These are the values that we want to get every 3rd of, that is, we want to get 1, 4, 7, 10, and so on.
Column B contains an incorrect attempt at using the OFFSET approach but where we forgot to use $. As can be seen, while we multiply by 3, we actually get every 4th row.
Column C contains an incorrect attempt at using the OFFSET approach where we remembered to use $, but forgot to subtract. So while we do get every 3rd value, we skipped some values (1 and 4).
Column D contains a correct function using the OFFSET approach.
Column E contains an incorrect attempt at using the ADDRESS + INDRECT approach, but where we forgot to subtract. Thus we skipped some rows initially. The same problem as with column C.
Column F contains a correct function using the ADDRESS + INDRECT approach.
If I were confronted with extracting every 7th row I would “insert” a column before Column “A” . I would then (assuming that there is a header row in row 1) type in the numbers 1,2,3,4,5,6,7 in rows 2,3,4,5,6,7,8, I would highlight the 1,2,3,4,5,6,7 and paste that block to the end of the sheet (700 rows worth). The result will be 1,23,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7……. Now do a data sort ascending on column “A”. After the sort all of the 1’s will be the first in the series, all of the 7’s will be the seventh item.
insert a new column and put a series in 1,2,3,4, etc. Then create another new column and use the command =if(int(a1/7)=(a1/7),1,0) you should get a 1 in every 7th row, filter the column on the 1
Highlight the 7th line. Paintbrush the format for the first 7 lines a few times. Then do a bigger chunk of paintbrush copying the format until you are done. Every 7th line should be highlighted. Filter by color and then copy and paste (paste the values) from the highlighted cells into a new sheet.
Create a macro and use the following code to grab the data and put it in a new sheet (Sheet2):
Dim strValue As String
Dim strCellNum As String
Dim x As String
x = 1
For i = 1 To 700 Step 7
strCellNum = "A" & i
strValue = Worksheets("Sheet1").Range(strCellNum).Value
Debug.Print strValue
Worksheets("Sheet2").Range("A" & x).Value = strValue
x = x + 1
Next
Let me know if this helps!
JFV
If your original data is in column form with multiple columns and the first entry of your original data in C42, and you want your new (down-sampled) data to be in column form as well, but only every seventh row, then you will also need to subtract out the row number of the first entry, like so:
=OFFSET(C$42,(ROW(C42)-ROW(C$42))*7,0)
Add new column and fill it with ascending numbers. Then filter by ([column] mod 7 = 0) or something like that (don't have Excel in front of me to actually try this);
If you can't filter by formula, add one more column and use the formula =MOD([column; 7]) in it then filter zeros and you'll get all seventh rows.

Resources