+ Reply to Thread
Results 1 to 12 of 12

Exclusive Lookup to match Rowwise data and give the Column Heading..

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Exclusive Lookup to match Rowwise data and give the Column Heading..

    I have the data as shown below

    Please find the attachment

    Now , AS u see in the above table if I have Yes in the Cells G2 and G3 then my answer should be "Col C" and not Col F though it has "X" in both Row 2 and Row 3 but it has and additional "X" in ROw 3 which does not march with the YEs.
    Attached Files Attached Files
    Last edited by e4excel; 06-22-2010 at 04:42 PM.

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

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Please describe the logic, generally.

    Why would G3 pick up column C instead of column B or F?, etc.
    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.

  3. #3
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Hi
    try this one

    =INDEX($A$1:$G$1,MODE(IF(($G$2:$G$4="yes")*($B$2:$F$4="x"),COLUMN($B$1:$F$4))))

    Confirm w/ Ctrl+Shift+Enter

    is that helps you????
    Last edited by contaminated; 06-22-2010 at 04:10 PM.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  4. #4
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    That definitely helps ..

    However is there a solution without using Arrays?

    Like some kind of SUMPRODUCT as this is one function which always comes up with Multiple Solutions?

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Quote Originally Posted by NBVC View Post
    Please describe the logic, generally.

    Why would G3 pick up column C instead of column B or F?, etc.
    We are looking for Exclusive Matches based on the "YES" in the columns..

    Like if there are "Yes in all the three cells then Col F would be an Ideal Choice.

    Therefore the choice would be in relation with the Yes

  6. #6
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Quote Originally Posted by contaminated View Post
    Hi
    try this one

    =INDEX($A$1:$G$1,MODE(IF(($G$2:$G$4="yes")*($B$2:$F$4="x"),COLUMN($B$1:$F$4))))

    Can something be worked to get an Empty Column when there are no "Yes's " mentioned?

  7. #7
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Dear Contaminated,

    This works really well for the condition mentioned in my original query however I did not realise that it would be important to get the Blank Option too as this is a concept to validate a set of options if there are no options clicked "yes" then it should be the Blank Option but I want to somehow avoid doing it as default in case of a false condtion to your coding ..

    So please help me on this tooo!

  8. #8
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Smile Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    However is there a solution without using Arrays?
    =INDEX(A1:G1,MODE(SMALL(--INDEX(SUBSTITUTE((G2:G4="Yes")*NOT(ISBLANK(B2:F4))*(COLUMN(B2:F4)),0,9^9),0),INDEX(ROW(INDIRECT("1:"&SUM(INDEX((G2:G4="Yes")*NOT(ISBLANK(B2:F4)),0)))),0))))

    set of options if there are no options clicked "yes" then it should be the Blank Option
    =IF(SUM(INDEX((G2:G4="yes")*1,0)),INDEX(A1:G1,MODE(SMALL(--INDEX(SUBSTITUTE((G2:G4="Yes")*NOT(ISBLANK(B2:F4))*(COLUMN(B2:F4)),0,9^9),0),INDEX(ROW(INDIRECT("1:"&SUM(INDEX((G2:G4="Yes")*NOT(ISBLANK(B2:F4)),0)))),0)))),"Blank Option")

    Both formulaes are confirmed just with Enter button
    Last edited by contaminated; 06-23-2010 at 11:23 AM.

  9. #9
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Dear Contaminated,

    Let me try and get back to you..

    Thanks a lot for the workaround...

  10. #10
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Hi Contaminated,

    Thanks a lot, This definitely works and can u please explain the code I think I will have to keep the false part as the default blank option..

    The First Column would be blank so incase of no option selected I will force it to display Col A which is not showing in the file attached..

    One thing I do not undestand is to How to check if all the three cells i.e G2,G3 AND G4 are blank in one code without using arrays..

  11. #11
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Try to use COUNTA function to determine if all three cells are empty. Forexample if =COUNTA(G2:G4) will retrn 0, this would mean then none of those cells are filled.

    =IF(COUNTA(Range),ValueIfTrue,ValueIfFalse)

  12. #12
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Exclusive Lookup to match Rowwise data and give the Column Heading..

    Quote Originally Posted by contaminated View Post
    Try to use COUNTA function to determine if all three cells are empty. Forexample if =COUNTA(G2:G4) will retrn 0, this would mean then none of those cells are filled.

    =IF(COUNTA(Range),ValueIfTrue,ValueIfFalse)
    Yeah I should have thought of that!

    Very stupid of me. But I was actually trying to avoid a default Blank Condition by giving Col A as incase if some other Col other than A is blank then that would not be attained with a default code..

    Anyways, so far so good however if you can please explain the code incase if I need to expand on this logic it would be very useful....

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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