+ Reply to Thread
Results 1 to 10 of 10

Return most common text from column cells with formula while ignoring blanks

  1. #1
    Registered User
    Join Date
    10-29-2014
    Location
    Tranmere, South Australia
    MS-Off Ver
    2007
    Posts
    3

    Return most common text from column cells with formula while ignoring blanks

    Hi,

    Have used this forum many times to work through excel problems and have marveled at some of the responses. You guys rock! However, I have one problem now that I can't find a solution for and was hoping you could help me.

    I have a spreadsheet which in cells $W8:W49 have formula in it to return a text string if corresponding cells from lower order columns have certain text in them. an example of the formula is as follows:

    =IF((E8="O")*AND(F8="O"),'G:\[Evacuation Data.xlsx]Building & Codes'!P8,IF((E8="O")*AND(F8="P"),'G:\[Evacuation Data.xlsx]Building & Codes'!M8,))

    If the corresponding cell is blank, no text is displayed but the formula is in there still to check.

    This works fine but, when I want cell W53 to return the most common text in $W$8:$W$49 it doesn't discriminate between so called blank cells (due to formula in cells I think) and those with the text in them.
    I have been using the following array formula {}:

    =INDEX($W$8:$W$49,MATCH(MAX(COUNTIF($W$8:$W$49,$W$8:$W$49),),COUNTIF($W$8:$W$49,$W$8:$W$49),0))

    This seems to work but if there are more blanks than text filled cells it returns blank.

    I need it to give me the most common of text if text appears. I have tried variations using "?*" but cant find one that works.

    Your help would be much appreciated if you can solve this for me. I initially wanted the top 3 text strings (in separate cells) but narrowed to the top one because it was becoming to complex and time consuming. If it can do the top 3 (in separate cells) I would be jumping for joy.

    Thank you in advance and i look forward to seeing you solutions.

    Rosco01995.

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Return most common text from column cells with formula while ignoring blanks

    Hi,

    an attempt using a small fix:


    Please Login or Register  to view this content.

    Array entered

    Hope it helps
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

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

    Re: Return most common text from column cells with formula while ignoring blanks

    Hi Rosco and welcome to the forum,

    You are asking for an Array formula that are hard for most of us to figure out.

    I lean a lot on Pivot Tables for this type of problem that doesn't need formulas. See the attached where I've created 5 random names and counted them using a pivot table. It is also very easy to eliminate blanks. See if this will help with your problem.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Return most common text from column cells with formula while ignoring blanks

    Sample file would make answering easier, but lets try blind:

    Please Login or Register  to view this content.
    and copy down 3 (or better 4) rows.
    Best Regards,

    Kaper

  5. #5
    Registered User
    Join Date
    10-29-2014
    Location
    Tranmere, South Australia
    MS-Off Ver
    2007
    Posts
    3

    Re: Return most common text from column cells with formula while ignoring blanks

    To all replies so far,

    Thank you so much for the replies but all except the pivot table are still returning blank. The pivot table is a good way if the text stays the same but it needs to be dynamic as it may/will change frequently based on evolving data.

    I have uploaded a sample of what I need with what I have in my original post.

    Thank you for your answers so quickly.

    Rosco01995
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Return most common text from column cells with formula while ignoring blanks

    Hi again,

    formula excludes zeros


    Please Login or Register  to view this content.
    to be confirmed with control+shift+enter.

    Hope it helps
    Last edited by canapone; 10-29-2014 at 02:45 AM.

  7. #7
    Registered User
    Join Date
    10-29-2014
    Location
    Tranmere, South Australia
    MS-Off Ver
    2007
    Posts
    3

    Re: Return most common text from column cells with formula while ignoring blanks

    Canapone, Thank you that worked brilliantly and gives me the top one (most frequent) every time. Many, many Thanks to all.

  8. #8
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: Return most common text from column cells with formula while ignoring blanks

    Hi,

    Another option, Confirm with ctrl+Shift+Enter.

    =INDEX($W$8:$W$49,MODE(IF($W$8:$W$49<>0,MATCH($W$8:$W$49,$W$8:$W$49,0))))

    Regards,

  9. #9
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Return most common text from column cells with formula while ignoring blanks

    ---
    double post
    ---

  10. #10
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Return most common text from column cells with formula while ignoring blanks

    Hi,

    thanks for providing kind feedback.

    I find Misrasomendra's approach more elegant.

    Regards

+ 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. [SOLVED] VBA Macro - Insert Rows based on different Column Value but Ignoring Blanks Cells
    By WITJ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-12-2013, 03:11 PM
  2. sum cells ignoring ones with blanks
    By kiwiingrid in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-04-2012, 06:03 PM
  3. copy cells ignoring blanks
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2011, 10:35 AM
  4. Average ignoring Blanks cells
    By Justinmih in forum Excel General
    Replies: 10
    Last Post: 09-30-2011, 06:21 PM
  5. Excel 2007 : sum cells ignoring blanks and text
    By mickurje in forum Excel General
    Replies: 2
    Last Post: 07-04-2010, 03:00 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