+ Reply to Thread
Results 1 to 25 of 25

NEED HELP: How do I index only among rows that contain a specific text

  1. #1
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Question NEED HELP: How do I index only among rows that contain a specific text

    I am trying to use a formula to find the largest value and return the name in an adjacent column, but I only want it to search among the rows that have the same label.

    Here is the formula I am using =INDEX('DATA TAB'!B$9:B$1000,(MATCH(LARGE('DATA TAB'!D$9:D$1000,1),'DATA TAB'!D$9:D$1000,0)))

    This works, but it's looking in all the rows. I want to add an element to this formula that tells excel "Among the rows that have the word "Buick", use the formula. I can't figure out how to limit the formula to search for all the rows that have the word "Buick" in column A before doing the above Index. Please help!!!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,333

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Hi Vincodi and welcome to the forum,

    I'm trying to understand your question and build a worksheet that might be close. See my answer using a Pivot Table and the Rank feature in Pivots. I might not even be close to what you want with the attached.

    Where to buy a car.xlsx

    You need to give us a sample workbook so we can understand the problem better and show how you want the answer.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. 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 shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    See the attachment. My goal is to paste the data into the DATA Tab and have the Boxes in the Buick populate with the only the buick dealers. My current formula cannot differentiate the Buick dealers form the rest.
    Attached Files Attached Files

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    In B6, try this:

    =INDEX('DATA TAB'!B$2:B$511,(MATCH(LARGE(IF('DATA TAB'!A$2:A$511="BUICK",'DATA TAB'!D$2:D$511),1),'DATA TAB'!D$2:D$511,0))) Ctrl Shift Enter

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Note that you can also substitute ROWS(A$1:A1) for 1 so that you do not have to manually adjust each formula in column B.

    That is:

    =INDEX('DATA TAB'!B$2:B$511,(MATCH(LARGE(IF('DATA TAB'!A$2:A$511="BUICK",'DATA TAB'!D$2:D$511),ROWS(A$1:A1)),'DATA TAB'!D$2:D$511,0))) Ctrl Shift Enter

  6. #6
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Great that works!

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,827

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Try

    =INDEX('DATA TAB'!B$9:B$1000,(MATCH(LARGE(('DATA TAB'!D$9:D$1000)*('DATA TAB'!A$9:A$1000=S1),1),('DATA TAB'!D$9:D$1000)*('DATA TAB'!A$9:A$1000=S1),0)))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Great, glad we could help.

    If that solved your question, please mark this thread as SOLVED.

  9. #9
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Actuallly, I found an error. The formula is not using the BUICK qualifier to ignore the rows that don;t have BUICk. For example, there are several dealers that have the same number of sales, and the formula is not skipping those without BUICK. Any suggestions?

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    All of the formulas that have been provided in this thread are working for me.

    Exactly where do you see an error?

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,827

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Try formula in post #7 but change start row to 3 i.e.

    =INDEX('DATA TAB'!B$3:B$1000,(MATCH(LARGE(('DATA TAB'!D$3:D$1000)*('DATA TAB'!A$3:A$1000=S1),1),('DATA TAB'!D$3:D$1000)*('DATA TAB'!A$3:A$1000=S1),0)))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  12. #12
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    The formula is working, but is returning values from rows that do not meet the "BUICK" criteria. It's working for the first 3 dealers, but there are 5 dealers with 1 sales. The formula is returning dealers with 1 sles which do not meet the BUICK criteria.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,827

    Re: NEED HELP: How do I index only among rows that contain a specific text

    See attached:
    Attached Files Attached Files

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Correction to my formula:

    =INDEX('DATA TAB'!B$2:B$511,(MATCH("BUICK"&LARGE(IF('DATA TAB'!A$2:A$511="BUICK",'DATA TAB'!D$2:D$511),ROWS(A$1:A1)),'DATA TAB'!A$2:A$511&'DATA TAB'!D$2:D$511,0))) Ctrl Shift Enter

  15. #15
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    That worked...sort of. It ignored the non-Buick rows and output the dealer with 1 sales, but there are 4 more dealers in the buick rows with 1 sales and it's not outputting those. It just outputs the first 1 sales dealer 5 times. Any idea how to get it to out put the other 4 delaers with 1 sales?

  16. #16
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Vincodi, you have multiple people contributing to this thread. Please include who you are referring to.

  17. #17
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Sorry. I was referring to you, 63FalconDude.

  18. #18
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    I see. There can be multiple instances of BUICK in column A and 14 (for example) in column D.

    INDEX MATCH pulls the first match. This will require the formula to pull multiple matches.

    John, I believe that your solution will have the same issue.

    I'll have to think on this one. I know that I can make it work with a helper column but I'd rather not do that if I can help it.

  19. #19
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,333

    Re: NEED HELP: How do I index only among rows that contain a specific text

    I'm so happy you guys are using my example data. But if there are duplicates the Sum in my Pivot Table doesn't work. If we use Min instead of Sum it might give what is wanted. See attached. Pivot Tables don't need formulas.

    Where to buy a car 2.xlsx

  20. #20
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Quote Originally Posted by 63falcondude View Post
    Vincodi, you have multiple people contributing to this thread. Please include who you are referring to.
    Sorry. I was referring to you last formula. Totally worked except for when the number of sales are equal. It will only output the first dealer. So if 5 dealers have 1 sales, it will output the first dealer 5 times. Anyway to have it output each of the 5 dealers with 1 sale?

  21. #21
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,827

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Try

    =INDEX('DATA TAB'!B$3:B$1000,(MATCH(LARGE(('DATA TAB'!D$3:D$1000)*('DATA TAB'!A$3:A$1000=$S$1)+(ROW(D$3:D$1000)*10^-3),ROWS($1:14)),('DATA TAB'!D$3:D$1000)*('DATA TAB'!A$3:A$1000=$S$1)+(ROW(D$3:D$1000)*10^-3),0)))

  22. #22
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Quote Originally Posted by 63falcondude View Post
    I see. There can be multiple instances of BUICK in column A and 14 (for example) in column D.

    INDEX MATCH pulls the first match. This will require the formula to pull multiple matches.

    John, I believe that your solution will have the same issue.

    I'll have to think on this one. I know that I can make it work with a helper column but I'd rather not do that if I can help it.
    Is there something we can add to the current formula =INDEX('DATA TAB'!$B$10:$B$1000,(MATCH("BUICK"&LARGE(IF('DATA TAB'!$A$10:$A$1000="BUICK",'DATA TAB'!J$10:J$1000),ROWS($A$1:$A3)),'DATA TAB'!$A$10:$A$1000&'DATA TAB'!J$10:J$1000,0))) which will tell it if the dealer output in the row above has the same number of sales, exclude that and output the next dealer?

  23. #23
    Registered User
    Join Date
    10-16-2017
    Location
    NYV
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Quote Originally Posted by MarvinP View Post
    I'm so happy you guys are using my example data. But if there are duplicates the Sum in my Pivot Table doesn't work. If we use Min instead of Sum it might give what is wanted. See attached. Pivot Tables don't need formulas.

    Attachment 542979
    Thank for your help. For this project, my goal is to paste raw data and have the formulas do all the work. I am trying to automate a very labor intensive process for employees who are very excel illiterate, so my hope is to use only formulas as pivot tables would cause too much confusion. Thanks for your help with this.

  24. #24
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,333

    Re: NEED HELP: How do I index only among rows that contain a specific text

    so my hope is to use only formulas as pivot tables would cause too much confusion.
    Keep typing those formulas then!

  25. #25
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: NEED HELP: How do I index only among rows that contain a specific text

    Due to the complexity of this, if you insist on using formulas, I felt it best to create a helper column.

    In the DATA TAB worksheet:

    H3 =IFERROR(LARGE(IF(A$2:A$511="BUICK",D$2:D$511),ROWS(A$1:A1)),"") Ctrl Shift Enter
    Drag this down until you get blanks (or to row 511).

    I3 =IFERROR(INDEX(B$3:B$510,SMALL(IF((D$3:D$510=H3)*(A$3:A$510="BUICK"),ROW(D$3:D$510)-(ROW(D$3)-1)),COUNTIF(H$3:H3,H3))),"") Ctrl Shift Enter
    Drag this down as far as the formula in column H.

    You can put these formulas wherever you want and hide the helper column if need be. Just note that you will have to include the sheet references if moving the formulas off of the DATA TAB worksheet.

    See attachment for clarification.
    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. Index Match to identify rows containing specific data
    By Smudge.Smith in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-10-2017, 09:52 AM
  2. Taking rows containing specific text and moving to specific tab.
    By X82 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-11-2016, 11:53 AM
  3. Delete Rows with specific text in specific column
    By love2waltz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2015, 10:16 AM
  4. [SOLVED] Copy rows with specific text in specific column into specific sheet
    By Valemaar in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-22-2014, 03:23 PM
  5. Replies: 3
    Last Post: 08-06-2014, 07:57 AM
  6. Deleting rows if specific cell is blank or have specific text
    By JoaoFerreira1985 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2013, 01:18 PM
  7. Replies: 3
    Last Post: 02-16-2013, 06:10 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