+ Reply to Thread
Results 1 to 6 of 6

Transpose previous value to next column based on conditions

  1. #1
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Transpose previous value to next column based on conditions

    I hope this is relatively simple.

    I need to transpose the previous value from a row to the next available column. However, this should be based on the value in Col A. So if the value in Col A changes, they cycle should start again. It should also only go to a maximum of the last 20 rows then start again.

    I have attached a sample of what I am trying to do. I need to fill each of the "Num.x" columns. My data has over 10,000 rows.
    Attached Files Attached Files
    Last edited by maym; 11-26-2020 at 09:57 PM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Transpose previous value to next column based on conditions

    A, B,C is OK
    But D, after 20 reached, does the cycle logic change?
    Last 4 rows, 1st column, why not 3,3,3,3 and 2nd column, why not 0,0,0,0?
    What is the logic behind?
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    10-12-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2016 in 2024
    Posts
    857

    Re: Transpose previous value to next column based on conditions

    After D, it doesn't change.

    Last 4 rows, it is different because the max of 20 rows have been transposed. V55 is the last of the 20 (value in B54).

    So it starts again, and B56 is value in B36, and so on. Hope that makes sense.

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Transpose previous value to next column based on conditions

    Please try at C2

    =IF(COUNTIFS($A$2:$A2,$A2)-COLUMNS($C2:C2)>0,INDEX($B$1:$B2,MAX(0,COUNTIFS($A$2:$A2,$A2)-21)+COLUMNS($C2:C2)+MATCH(2,1/($A$1:$A2<>$A2))),"")
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,581

    Re: Transpose previous value to next column based on conditions

    In C2 then copy across
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Transpose previous value to next column based on conditions

    Change C1 to value "1" then format it as "Num."#,
    D1=C1+1
    Drag accross
    C2:
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. VBA - Creating new column (Columns M) with values based on previous column (Column L)
    By will12321 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2020, 03:36 AM
  2. [SOLVED] Copy, paste and transpose selected data to new worksheet based on conditions
    By Grilleman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2019, 12:59 PM
  3. [SOLVED] Transpose data from one column based on criteria of a different column with VBA Arrays
    By Anasurimbor in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-03-2018, 09:01 AM
  4. Transpose variable based on 2 conditions
    By jam320 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-13-2015, 11:00 AM
  5. Transpose swipe timings based on 3 Conditions
    By vasu2007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2015, 01:17 PM
  6. [SOLVED] Transpose column to rows based on conditions
    By thaykhov in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2013, 02:35 AM
  7. Transpose values from column to rows (one cell) with conditions
    By zeko90 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2013, 08:21 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