+ Reply to Thread
Results 1 to 16 of 16

Transpose from One Column to Another based on a Condition

  1. #1
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Transpose from One Column to Another based on a Condition

    I, for the life of me, can't figure this out (and I'm sure it's fairly simple). I'm trying to transpose unique values from one sheet to another BUT based on a condition.

    In the example below I'd like to pull any Record#s (columnA) that have "yes" as the data3 (columnD) into the resulting table (column F). This data is generated from the data changes regularly and I have several scenarios/results tables to build and I'd like it to be a formula and not manual. Macros cannot be enabled in my environment.

    Any help would be greatly appreciated!


    Source:

    Record# Data1 Data2 Data3
    1 a 11 Yes
    2 b 12 No
    3 c 13 Yes
    4 d 14 No
    5 e 15 Yes
    6 f 16 Yes


    Result:

    Result Data3
    1 Yes
    3 Yes
    5 Yes
    6 Yes


    transpose question.png

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Transpose from One Column to Another based on a Condition

    sample files generally better than pictures but, perhaps:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    Thanks for the reply! Unfortunately I'm getting a #value error. A couple of additional pieces information:

    1. this is using named ranges for record# and data3
    2. I don't need the data3 values for this as I can just do a quick vlookup and fill in the rest of the table (which is quite lengthy)
    Last edited by jonathan.phillips; 03-18-2022 at 10:30 AM.

  4. #4
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    Here's a sample table - hopefully I'm attaching/including it properly this time.
    Attached Files Attached Files

  5. #5
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Transpose from One Column to Another based on a Condition

    clear D6:D12 then if, as you say, you only want the first column from source range simply apply below to D6:

    =FILTER(A6:A12,B6:B12=E3)

  6. #6
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    Thanks again for the reply but now I'm getting a #CALC error. The adjusted formula I'm using is: =FILTER(Data!$A$9$:A$22,Data!$K$9:$K$22="delayed") where A9:A22 is my record# column and K9:K22 is the criteria column.

    This is referencing a different sheet within the workbook - could that be the issue?

  7. #7
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Transpose from One Column to Another based on a Condition

    Shouldn't be an issue referencing a different sheet, that error occurs if it finds no results for the filter, is that the case here?

  8. #8
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    That was it. The data was "delayed ...". How can I make this a little more dynamic and allow for other variations of this status code? i.e. "Delayed*"

  9. #9
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Transpose from One Column to Another based on a Condition

    Try:

    =FILTER(Data!$A$9$:A$22,ISNUMBER(SEARCH("Delayed",Data!$K$9:$K$22)))

  10. #10
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    Perfect, thank you!

  11. #11
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    Ok, any chance you can tell me what's wrong with this formula. I've added a 2nd condition to check the date (which is in text form).

    FULLTABLE = entire source table
    COLLECT = date (as text) in format of "YYYY-MM-DD"
    STATUS = text where we find "delayed"

    {=FILTER(FULLTABLE, (COLLECT<=TEXT(TODAY()+1, "YYYY-MM-DD"))*(ISNUMBER(SEARCH({"clearance","booked","ok to ship","hold","collection attempt"},STATUS))))

  12. #12
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Transpose from One Column to Another based on a Condition

    What is not working? Error or wrong result? I guess error as I don't think you can pass a 2-d array to FILTER, which is what gets created when you use SEARCH with an array like that. There's probably a way around it though. I might get a chance to look tomorrow, if nobody else does first.

  13. #13
    Forum Contributor John Vergara's Avatar
    Join Date
    01-17-2022
    Location
    Colombia
    MS-Off Ver
    365
    Posts
    200

    Re: Transpose from One Column to Another based on a Condition

    Hi to all!
    Quote Originally Posted by jonathan.phillips View Post
    Ok, any chance you can tell me what's wrong with this formula...
    You can't use 2D arrays into the include argument of FILTER. If I get what you want, you can use this formula:
    PHP Code: 
    =FILTER(FULLTABLE, (COLLECT<=TEXT(TODAY()+1"YYYY-MM-DD"))*(MMULT(--ISNUMBER(SEARCH({"clearance","booked","ok to ship","hold","collection attempt"},STATUS)), {1;1;1;1;1}))) 
    Blessings!

  14. #14
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Transpose from One Column to Another based on a Condition

    FWIW, the use of SEARCH (as opposed to MATCH) implies that your criteria are embedded within longer strings (STATUS) however, your earlier post (K-range="delayed") implies that might not be the case...

    So, if the terms are, in fact, stored as isolated strings in STATUS you could use:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    i.e. you simply bookend STATUS values with a delimiter (pipe in this case) then search this value against the delimited concatenation of search terms -- in this context, bookending terms removes risk of false positives.

  15. #15
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    That did it! Looks like I need to do some youtube watching on these various elements - i've never heard of MMULT.

  16. #16
    Registered User
    Join Date
    03-18-2022
    Location
    Raleigh, NC
    MS-Off Ver
    365
    Posts
    11

    Re: Transpose from One Column to Another based on a Condition

    Unfortunately, they are not static strings and there is a lot of variability in the text strings of STATUS.

+ 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. How to transpose based on first column?
    By stan255 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2021, 04:04 AM
  2. [SOLVED] Transpose Column to Row but with condition
    By rr1050 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-26-2020, 10:33 AM
  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. [SOLVED] My vba Transpose with condition, but its transposing the condition from other range
    By Franky alta in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-28-2015, 03:56 PM
  5. Need to have values pasted in Transpose based on some condition.
    By manojkumarcr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2014, 04:49 AM
  6. Transpose 2nd column based on repeats in 1st column
    By GregJ in forum Excel General
    Replies: 4
    Last Post: 03-19-2009, 04:29 AM
  7. Transpose rows and column with condition
    By ananthakumar.e in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2008, 07:45 PM

Tags for this Thread

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