+ Reply to Thread
Results 1 to 7 of 7

Copy rows in sheet if certain cell contains text

  1. #1
    Registered User
    Join Date
    11-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Copy rows in sheet if certain cell contains text

    Hi, basically I have a sheet that contains a number of rows with text in, the end cell on each row does not always contain some text. So what I'm looking to do is for the cells that do contain text, copy that entire row into another sheet?
    How would I go about doing this?

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Copy rows in sheet if certain cell contains text

    You can do it with a few formulae - attach a sample workbook and I can show you how.

    Pete

  3. #3
    Registered User
    Join Date
    11-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Copy rows in sheet if certain cell contains text

    Hi Pete, I've attached a basic spreadsheet where on the end cells some are empty as explained
    Attached Files Attached Files

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Copy rows in sheet if certain cell contains text

    I've used column K as a helper column in both sheets (shown in blue), with this formula in K2 of Sheet1:

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


    This gives an increasing sequential count of the records which meet the criteria when copied down the column. I've copied to row 15 (i.e. beyond your data) - the hyphens help to show how far it has been copied. I've used this formula in K2 of Sheet2:

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


    which tells us the rows on Sheet1 where those sequential numbers occur. In A2 of Sheet2 I have used this formula:

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


    which retrieves the data from column A of Sheet1 where there is a row number in column K. This formula can be copied across into B2:I2 to retrieve data from the corresponding columns in Sheet1. Then all the formulae on row 2 can be copied down as far as you need - again, I've copied to row 15, as shown by the hyphens in column K.

    So, in Sheet2 you have all the records from Sheet1 where column I contains "Available".

    Hope this helps.

    Pete
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-13-2013
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Copy rows in sheet if certain cell contains text

    That looks ideal, the only issue that I forgot to mention is that the text where it says available may not always have that specific phrase it may be a number of other entries, how does this affect the formulae?

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Copy rows in sheet if certain cell contains text

    You can change the first formula in Sheet1 to this:

    =IF(I2="","-",MAX(K$1:K1)+1)

    then copy down. You will get the numbers (and thus those records will be copied into Sheet2) if there is any text in column I.

    Hope this helps.

    Pete

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Copy rows in sheet if certain cell contains text

    If that takes care of your original question, please select Thread Tools from the menu above your first post and mark this thread as SOLVED.

    Also, since you are relatively new to the forum, I would like to inform you that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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 find a text string and then copy the next 5 rows to a new sheet
    By jmorisey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2013, 03:32 PM
  2. Copy Rows into a new sheet if a column has certain text entered
    By SusieE76 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2012, 02:31 AM
  3. [SOLVED] Macro to Copy rows to a new sheet that contain certain text
    By megdawom in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2012, 02:11 PM
  4. Copy Rows from selected Sheet to New Sheet based on Cell Value
    By joemcmillen in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 04-03-2008, 03:44 PM
  5. copy rows that contain certain text to a new sheet including the h
    By mike in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-05-2005, 10:35 AM

Tags for this Thread

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