+ Reply to Thread
Results 1 to 29 of 29

Formula to lookup up text in a table and list in sequential rows

  1. #1
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Question Formula to lookup up text in a table and list in sequential rows

    See attached example. Using the data on the Data sheet, I want to choose the district from the drop-down list and have the results listed sequentially on the Output sheet. So, if you choose District 10, row 2 will be the first set of district 10 data, row 3 will be the next set of district 10 data.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Formula to lookup up text in a table and list in sequential rows

    Hi,

    There is no formula that could do this for you in Excel, but it could certainly be done using some VBA. Try inserting this subroutine into the "Data" Worksheet module:
    Please Login or Register  to view this content.
    I have also attached the workbook for you to look at if you would like.

    Hope this helps
    Attached Files Attached Files

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    In A2 Cell of Output Sheet - Array Formula - Requires CTRL+SHIFT+ENTER

    =IFERROR(INDEX(Data!$A$3:$I$12,SMALL(IF((Data!$H$3:$H$12*1)=Data!$B$18,ROW(Data!$H$3:$H$12)-ROW(Data!$H$3)+1),ROW($A1)),MATCH(A$1,Data!$A$2:$I$2,0)),"")

    Drag it down and right...


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Formula to lookup up text in a table and list in sequential rows

    Hahaha I've got to stop assuming things can't be done without VBA!

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    It's good to offer both to the OP... So that OP can pick the one in which he/she feels comfortable. At the same time OP also will aware of both the methods

  6. #6
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    Works perfectly, thank you. You are a master!

  7. #7
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    I ran into a problem. What if in my data set for the district number there is text, it appears all results disappear? In that column my data could say "No Info", so how do I account for the text in the column?

  8. #8
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Formula to lookup up text in a table and list in sequential rows

    Hi Brett,

    I'm not sure who's method you implemented, but I don't think the VBA method that I provided you should stop working even if there is text in the District column.

    Can you please upload what you have done in an attachment, and also state which solution you have attempted to implement so that the appropriate contributor can assist you with correcting it.

    Thanks

  9. #9
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    I was using the formula version. I figured out a work-around for the text issue, but for some reason, when I use the formula as written above (but adapted for my actual worksheet), it always skips the first row of data it finds based on the district criteria. So, it is listing the results sequentially, but it always starts with the second set of data it finds, never the first. My actual formula is:

    =IFERROR(INDEX(Table3,SMALL(IF((Table3[Column1]*1)='RSVP Analysis'!$J$2,ROW(Table3[Column1])-ROW('SOW Analysis'!$AC$2)+1),ROW($A2)),MATCH(A$2,Table3[#Headers],0)),"")

  10. #10
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Formula to lookup up text in a table and list in sequential rows

    Hmmm, interesting behaviour.

    I can have a look at the actual workbook and help you try to figure out the problem, or perhaps Sixthsense will see this post and be able to help you without the workbook.

  11. #11
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    Just remove the *1 from the suggested formula.

  12. #12
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Formula to lookup up text in a table and list in sequential rows

    Hahahaha just as I suspected. Thanks lol

  13. #13
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows



    I suggested it in my initial thread because OP is comparing the Real Value (In Validation) with Text Values (Range) so I just added it to convert all the values as real values.

    So it is not required when the OP compares the same type of text.

  14. #14
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    Sixthsense,

    I removed the *1 from the formula and I am still not getting the first set of data. It continues to start at the second set of data, so any other ideas to help make this work?

  15. #15
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    Also, if I want to display the results based on 2 sets of criteria, would my formula look like this if status of "Audit" was the second criteria?

    =IFERROR(INDEX(Table3,SMALL(IF(AND((Table3[Column1]*1)='RSVP Analysis'!$J$2,Table3[Current SOW Status]="audit"),ROW(Table3[Column1])-ROW('SOW Analysis'!$AC$2)+1),ROW($A2)),MATCH(A$2,Table3[#Headers],0)),"")

  16. #16
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    Sixthsense,

    Does your formula require the first set of data to be in Row 2 of the sheet? I had my sheet formatted with a title in Row 1, column titles in row 2, and your formula in row 3 (which was starting with the 2nd set of data), but when I deleted row 1 (with the data starting on row 2), now all of it appears. How do you indicate in your formula on which row to place the first set of data? Let's say I wanted it to start in Row 3 and go sequentially from there, am I changing +1 to +2?

  17. #17
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    Try this... Untested...

    =IFERROR(INDEX(Table3,SMALL(IF((Table3[Column1]='RSVP Analysis'!$J$2)*(Table3[Current SOW Status]="audit"),ROW(Table3[Column1])-ROW('SOW Analysis'!$AC$2)+1),ROW($A1)),MATCH(A$2,Table3[#Headers],0)),"")

    ROW('SOW Analysis'!$AC$2) should be the reference of 1st cell of your table and should not be a tale reference should be a cell reference.

  18. #18
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    Thanks. Since the output sheet displays the data sequentially, I cannot then apply a filter to sort the information. Is there a way to either sort the info once the output is finished or is there a way to sort the info as it is being looked up? For example, if the "Salesperson" was in column A and I had multiple Salespeople, can it sequntially list the data across the columns in a specific order...Salesperson A data, then Salesperson B data, etc...?

  19. #19
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    Please attach a sample workbook with enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Note: Please don't attach documents containing confidential data like (address, telephone, ID#s, etc.).

  20. #20
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    Sixthsense,

    I had my report working and then something happened that I can no longer display any data in my report (I do not know what happened). It appears there is an error in my formula, but I cannot figure it out. Can you help?

    Thanks
    Attached Files Attached Files

  21. #21
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    I don't know the reason why the formula is not working when the data set of Table3 increases more than 150 rows.... (appx). If you just keep the lesser rows in the table3 like 150 rows and delete the rest... then the formula getting the result perfectly....

  22. #22
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Formula to lookup up text in a table and list in sequential rows

    @ SS...

    in the table..

    select.. Specialcells(formula,error)
    6 #N/A.. obviously after 150 row..
    change them to Iferror..
    and reply if you are still surprise..
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  23. #23
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    Oh God!!! Thanks for fixing the exact root cause of the problem Debraj Roy

    I just added the error handler in the formula and it's working fine now....


    So the revised formula will be something like this...

    =IFERROR(INDEX(Table3,SMALL(IF(IF(NOT(ISNA(Table3[Column2])),Table3[Column2]=$C$6),ROW(Table3[Column2])-ROW($D$2)+1),ROW($D1)),MATCH(D$1,Table3[#Headers],0)),"")

  24. #24
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Formula to lookup up text in a table and list in sequential rows

    Sixthsense ..

    Thanks for appreciate..

    By the way.. Nice formula..

  25. #25
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    You're Welcome

    And even shorter... lol

    =IFERROR(INDEX(Table3,SMALL(IF(IFERROR(Table3[Column2]=$C$6,FALSE),ROW(Table3[Column2])-ROW($D$2)+1),ROW($D1)),MATCH(D$1,Table3[#Headers],0)),"")

  26. #26
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Formula to lookup up text in a table and list in sequential rows

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  27. #27
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    The only remaining issue is that using the recently attached example, if I change the default value in cell B18 to something other than "All Statuses", I get an error. Is the formula in cell D2 wrong with respect to that choice?

  28. #28
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Formula to lookup up text in a table and list in sequential rows

    Please attach the file with the newly suggested approach for better understanding
    Last edited by :) Sixthsense :); 09-23-2013 at 03:51 AM.

  29. #29
    Registered User
    Join Date
    08-13-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Formula to lookup up text in a table and list in sequential rows

    All,

    Thank you very much. I believe my issue is resolved and my sheet is now working correctly. The final formula was:

    {=IFERROR(IF(AND($B$18="ALL Statuses",$B$12="ALL Sales"),(INDEX(Table3,SMALL(IF(IFERROR(Table3[Column2]=$C$6,FALSE),ROW(Table3[Current SOW ID])-ROW('SOW Analysis'!$A$2)+1),ROW($E1)),MATCH(D$1,Table3[#Headers],0))),IF(AND($B$18="ALL Statuses",$B$12<>"ALL Sales"),(INDEX(Table3,SMALL(IF(IFERROR(Table3[Consultant]=$B$12,FALSE),ROW(Table3[Current SOW ID])-ROW('SOW Analysis'!$A$2)+1),ROW($E1)),MATCH(D$1,Table3[#Headers],0))),(IF($B$12="ALL Sales",(INDEX(Table3,SMALL(IF(IFERROR((Table3[Column2]=$C$6)*(Table3[Current SOW Status]=$B$18),FALSE),ROW(Table3[Current SOW ID])-ROW('SOW Analysis'!$A$2)+1),ROW($E1)),MATCH(D$1,Table3[#Headers],0))),(INDEX(Table3,SMALL(IF(IFERROR((Table3[Consultant]=$B$12)*(Table3[Current SOW Status]=$B$18),FALSE),ROW(Table3[Current SOW ID])-ROW('SOW Analysis'!$A$2)+1),ROW($E1)),MATCH(D$1,Table3[#Headers],0))))))),"")}

+ 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 lookup multiple rows from a table
    By trabical in forum Excel General
    Replies: 0
    Last Post: 01-28-2013, 05:46 PM
  2. [SOLVED] Array Formula to Lookup and Return All Rows in Table that Meet Single Criteria
    By Torkel74 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-15-2013, 10:41 PM
  3. Lookup Text in Table and Return Specified Text Value
    By mlukich in forum Excel General
    Replies: 3
    Last Post: 08-26-2011, 02:26 PM
  4. Formula to keep row numbers sequential AFTER rows are deleted.
    By cheddarthief in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2011, 09:24 AM
  5. How to copy sequential vales into non sequential rows
    By dchalem in forum Excel General
    Replies: 11
    Last Post: 01-18-2011, 12:19 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