+ Reply to Thread
Results 1 to 2 of 2

Variable Cell Refence Problem

  1. #1
    Registered User
    Join Date
    09-17-2008
    Location
    Chicago
    Posts
    1

    Variable Cell Refence Problem

    1st Post. Thanks ahead to everyone.

    I am having difficulty with a cell reference for a TRANSPOSE function where the 2nd reference has a variable row number. I have done a fair amount of googling with no answer.

    For my problem, I have a workbook like the following, sorted by column B, then, column A.

    . A B C D E
    1 2 01
    2 3 01
    3 2 05
    4 9 05
    5 12 05

    I need to transpose the data in collumn a across one row. for this example, lets say row 1. The starting cell for the transpose is known (in this case C2), but the ending row is variable and based on the the uniqueness of the data in column B. In my example, i would want to TRANSPOSE from A1 to A3 across row 1 beginning in column C. The next transpose would be from A3 to A5 across row 3 beginning in column C. So, I want the following:

    . A B C D E
    1 2 01 2 3
    2 3 01
    3 2 05 2 9 12
    4 9 05
    5 12 05

    I am not concerned about the data in row 2, 4 or 5 because I plan to hide all rows where only each unique value in row B shows.

    My problem is I am having trouble with the 2nd reference in the TRANSPOSE function I want to use because the row part of the reference is variable.

    In cell C1, I want

    =TRANSPOSE(A1:AX)
    where X=1+(COUNTIF(A:A,A1)-1

    Of course I can not use =TRANSPOSE(A1:A(1+(COUNTIF(A:A,A1)-1)), as it results in an error. So, how does one define a reference that is variable? If it just needed the value of a cell whose reference was variable, I could just use INDIRECT, but that doesn't apply here.

    Thank you for your assistance. Please excuse my lack of knowledge.
    Last edited by hankbug; 09-17-2008 at 02:12 PM. Reason: Reformat table

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Maybe you mean?

    =TRANSPOSE(A1:INDEX(A:A,1+(COUNTIF(A:A,A1)-1)))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ 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. Setting integer variable to cell contents
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2008, 03:53 PM
  2. Save As cell format problem
    By Jumpy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2007, 03:33 AM
  3. Cell problem
    By koda86 in forum Excel General
    Replies: 3
    Last Post: 06-14-2007, 03:35 PM
  4. sumif with a variable criteria and polynomial problem
    By Niels in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2006, 10:11 AM
  5. Problem with passing a cell reference
    By MrMagenta101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2006, 07:48 PM

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