MrExcel Message Board


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 6th, 2006, 10:06 PM   #1
mgirvin
 
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
Default reference every fourth cell

In cell A100 I would like to create a formula that I could copy downward to the range A100:A104 that would return the cell contents from A1, A4, A7 and A10. I have created a few large formulas that involve OFFSET, INDIRECT, ADDRESS and references to other cells that count intervals. But they are inelegant. Can anyone think of an elegant solution?

Examples of inelegance:

=INDIRECT(ADDRESS(ROW()-(ROW()-B111),COLUMN())), where B111 has a number to subtract and this one takes cell content from every fifth cell

or

=OFFSET(E11,-(COUNTBLANK($E$1:$E$10)+COUNTA($E$1:$E$10)+1-(COUNTBLANK($F$11:F11)+COUNTA($F$11:F11))),), this one takes every other cell.
__________________
Sincerely, Mike Gel Girvin
mgirvin is offline   Reply With Quote
Old Apr 6th, 2006, 10:19 PM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
Default

In A100 enter & copy down:

=INDEX($A$1:$A$10,3*(ROWS($A$100:A100)-1)+1)
Aladin Akyurek is offline   Reply With Quote
Old Apr 6th, 2006, 10:31 PM   #3
mgirvin
 
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
Default

Wow, Aladin!

That is great. Thank you for the genie-like elegance!
__________________
Sincerely, Mike Gel Girvin
mgirvin is offline   Reply With Quote
Old Apr 6th, 2006, 10:31 PM   #4
RalphA
 
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
Default

Here is my solution for data in A1, A4, A7 and A10 to appear in cells A101, A102, A103 and A104.

In cell A101, enter =INDIRECT("A"&1+3*MOD(ROW(),101)) and copy down.

Sorry, Aladin. I started when there were no responses, and didn't check to see if one had been posted in the meantime. Anyway, I think my solution is valid...
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer.
RalphA is offline   Reply With Quote
Old Apr 6th, 2006, 10:49 PM   #5
mgirvin
 
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
Default

Wow, RalphA!

Now I have two great solutions!

As this is my first post, I am amazed at the speed, efficiency and elegance of the responses.

Thanks so much! I am learning from both solutions.
__________________
Sincerely, Mike Gel Girvin
mgirvin is offline   Reply With Quote
Old Apr 6th, 2006, 11:28 PM   #6
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
Default

Quote:
Here is my solution for data in A1, A4, A7 and A10 to appear in cells A101, A102, A103 and A104.

In cell A101, enter =INDIRECT("A"&1+3*MOD(ROW(),101)) and copy down.

Sorry, Aladin. I started when there were no responses, and didn't check to see if one had been posted in the meantime. Anyway, I think my solution is valid...
It has some drawbacks though:

1) INDIRECT is volatile.
2) INDIRECT locks the operation to column A. That is, you have to edit the formula if the user inserts a column before the current column A.
3) The formula is not robust: Inserting rows before the row of the first formula cell would yield incorrect results.
4) Constants like 1 and 101 make the formula too specific.
Aladin Akyurek is offline   Reply With Quote
Old Apr 6th, 2006, 11:45 PM   #7
RalphA
 
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
Default

Aladin:

Hey, I'm no genius! All I did was to create a formula that would do what was required. I didn't say it was a universal solution, or non-volatile, or what ever. Give me a break!

But, if "A" is
Quote:
too specific
, one could change the "A" to 'char(64+column())'
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer.
RalphA is offline   Reply With Quote
Old Apr 7th, 2006, 12:17 AM   #8
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
Default

Quote:
Aladin:

Hey, I'm no genius! All I did was to create a formula that would do what was required. I didn't say it was a universal solution, or non-volatile, or what ever. Give me a break!
It is intended as a constructive comment...

But, if "A" is
Quote:
too specific
, one could change the "A" to 'char(64+column())'[/quote]

Constants like 1 and 101, make the formula too specific, not just "A". Did you test the CHAR(64+COLUMN()) expression?
Aladin Akyurek is offline   Reply With Quote
Old Apr 7th, 2006, 12:25 AM   #9
RalphA
 
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
Default

Aladin:

Thanks for the "constructive comment". I had wrongly interpreted it as a critique.

As for having tested the CHAR(64+COLUMN()), yes I certainly did. I copied the formula to A99, B99, C99 and D99, and it shows up as A, B, C and D, in the respective cells. Didn't you test it?
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer.
RalphA is offline   Reply With Quote
Old Apr 7th, 2006, 12:30 AM   #10
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
Default

Quote:
Aladin:

Thanks for the "constructive comment". I had wrongly interpreted it as a critique.
OK.

Quote:
As for having tested the CHAR(64+COLUMN()), yes I certainly did. I copied the formula to A99, B99, C99 and D99, and it shows up as A, B, C and D, in the respective cells. Didn't you test it?
I did: In AG99, I get the lower case a.
Aladin Akyurek is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT +1. The time now is 05:14 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes