+ Reply to Thread
Results 1 to 8 of 8

Fill in a column by a number column OR stretch a column

  1. #1
    Forum Contributor
    Join Date
    05-28-2010
    Location
    Antwerp, Belgium
    MS-Off Ver
    Office 365
    Posts
    170

    Fill in a column by a number column OR stretch a column

    I would like to achieve the following:

    Put in cell A1 this formula: =AVERAGEIF(O:O,$B$2,R:R) and when I stretch it down, it will just change the R:R to the next column.
    In A2 will be =AVERAGEIF(O:O,$B$2,S:S), in A3 will be =AVERAGEIF(O:O,$B$2,T:T)

    I thought to achieve it somehow by putting a number of column instead of R:R and then stretching it down, then the number would increase and the column would change..

    But I couldn't find the way to do it, but that's just a suggestion. Any idea would be welcome..

    Thanks

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Fill in a column by a number column OR stretch a column

    There may be a better way thank this, but this works...
    =AVERAGEIF(O:O,$B$2,INDIRECT(CHAR(114+ROW(D1))&":"&CHAR(114+ROW(D1))))

    It is coded to start in column S, so if that changes, you will need to find the number for that letter using =CODE("S") or wherever, then plug that value into the CHAR argument
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    05-28-2010
    Location
    Antwerp, Belgium
    MS-Off Ver
    Office 365
    Posts
    170

    Re: Fill in a column by a number column OR stretch a column

    Thanks!

    But still a problem now, because when I stretch it doesn't change the CHAR(114) to 115, 116 and etc.. what to do?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Fill in a column by a number column OR stretch a column

    No it doesnt, but thats what the ROW(D1) does (Char(114) is actually r)...

    for row 1...
    CHAR(114+ROW(D1))
    =114+1 115
    For row 2...
    CHAR(114+ROW(D2))
    =114+2=116
    For row 3...
    CHAR(114+ROW(D3))
    =114+3=117
    etc

    I used D1 in my sample that I created for this, but the column (D) doesnt really matter, its teh row number that does teh work. So it could be A1, B1, AAA1, it would still work the same

  5. #5
    Forum Contributor
    Join Date
    05-28-2010
    Location
    Antwerp, Belgium
    MS-Off Ver
    Office 365
    Posts
    170

    Re: Fill in a column by a number column OR stretch a column

    Ok, that works, BUT... then it comes to Z.. and then it has to switch to AA, but instead it goes to }

    CHAR(122) is Z, and CHAR(123) is already }, not AA.

    Any ideas here?

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Fill in a column by a number column OR stretch a column

    Try this...

    =AVERAGEIF(O:O,$B$2,INDEX(R:Z,0,ROWS(A$1:A1)))

    Adjust for the correct end of range column where I've used up to column Z.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Forum Contributor
    Join Date
    05-28-2010
    Location
    Antwerp, Belgium
    MS-Off Ver
    Office 365
    Posts
    170

    Re: Fill in a column by a number column OR stretch a column

    That's beautiful!

    Thank you both!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Fill in a column by a number column OR stretch a column

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 10-17-2014, 11:56 AM
  2. [SOLVED] need formula to this logic, A column number B column blank then C column desired name
    By vengatvj in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-02-2013, 10:30 PM
  3. [SOLVED] Fill a column with a set string depending on number of entries in column.
    By skyping in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-29-2013, 08:12 AM
  4. Add Date in Column A Plus Number of Days in Column B and show result in Column C
    By excelforumcrisis in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-12-2013, 02:01 PM
  5. Insert column and fill column upto where data is in previous column
    By aka189 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-24-2012, 06:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1