![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
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 |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
|
In A100 enter & copy down:
=INDEX($A$1:$A$10,3*(ROWS($A$100:A100)-1)+1) |
|
|
|
|
|
#3 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
Wow, Aladin!
That is great. Thank you for the genie-like elegance!
__________________
Sincerely, Mike Gel Girvin |
|
|
|
|
|
#4 |
|
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
|
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.
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer. |
|
|
|
|
|
#5 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
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 |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
|
Quote:
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. |
|
|
|
|
|
|
#7 | |
|
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
|
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:
__________________
Ralph A. Esquivel, Excel 97 SR2 (Ver. 8.0), Windows XP, Home Edition, Service Pack 2, HP LaserJet 4L printer. |
|
|
|
|
|
|
#8 | ||
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
|
Quote:
But, if "A" is Quote:
Constants like 1 and 101, make the formula too specific, not just "A". Did you test the CHAR(64+COLUMN()) expression? |
||
|
|
|
|
|
#9 |
|
Join Date: May 2003
Location: Katy, Texas
Posts: 3,829
|
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. |
|
|
|
|
|
#10 | ||
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
|
Quote:
Quote:
|
||
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|