+ Reply to Thread
Results 1 to 6 of 6

Help with rearranging text strings

  1. #1
    Registered User
    Join Date
    04-21-2015
    Location
    Toronto
    MS-Off Ver
    2013
    Posts
    4

    Help with rearranging text strings

    Hello,

    How would I take a column of text (in this case, names of companies) transfer those names to another sheet, but remove rows that are blank? I need to do this automatically (or dynamically), because that column of names changes is populated by an interaction from a pivot table and slicers.

    The column can be up to 3000 names long.

    Any ideas what functions I might explore?

    Thanks in advance,

    Daniel

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

    Re: Help with rearranging text strings

    Perhaps highlight the entire column/range of cells to copy, press F5 (Go To), Special, Constants
    _________________
    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!)

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,080

    Re: Help with rearranging text strings

    Could you maybe use the familiar

    =IFERROR(INDEX($A$1:$A$3000,SMALL((IF($A$1:$A$3000<>"",ROW(INDIRECT("1:"&ROWS($A$1:$A$3000))))),ROW(A1)),1),"")
    Array formula, use Ctrl-Shift-Enter

    to remove blanks
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help with rearranging text strings

    Name the range of values that you want to copy to another location without spaces between the values. Use the name in the following formula and ARRAY enter (Ctrl + shift + enter). I used the word RANGE.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The same formula without using a Named Range is:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Help with rearranging text strings

    I would just point out that the use of an IFERROR construction in such cases can be quite inefficient, and especially so if the range in question is a particularly large one.

    I think it's a touch unfortunate that almost all the sources around the various Excel sites seem to recommend such an approach, perhaps not realising just how costly it can be.

    See here for a more detailed explanation and a simple, more efficient set-up:

    http://superuser.com/questions/81272.../812848#812848

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help with rearranging text strings

    The IFERROR has to evaluate the whole formula contained within its () in order to determine error no error. Sometimes this is necessary but not for the case of running out of data like we have used above.
    The formula that I gave re-written to compare the number of values in the source vs the number of values returned by the formula without a helper cell would be:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This stops when the count of data being returned is greater than the count of data in the source. This would again be more efficient if the count was constant in a referenced cell.

    If the count (my formula using named ranges) is in F1 with the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    the formula then becomes:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Thanks for the reminder.

+ 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. Rearranging text in cells with macro
    By cm0002 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-16-2015, 09:13 AM
  2. Rearranging strings in a cell
    By joshnathan in forum Excel General
    Replies: 5
    Last Post: 05-21-2014, 10:22 AM
  3. Replies: 2
    Last Post: 03-07-2013, 02:34 AM
  4. Help searching an array of text strings for common strings
    By ABComp in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-23-2012, 11:19 PM
  5. Rearranging Text
    By NewExcelUser in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2006, 08:03 AM

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