+ Reply to Thread
Results 1 to 8 of 8

Copy content of cell to another worksheet if condition met with no blanks

  1. #1
    Registered User
    Join Date
    03-29-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    5

    Copy content of cell to another worksheet if condition met with no blanks

    I have searched through the forum and can't quite find the correct formula.

    I have a sheet with rows of data. I want to search through a column for any cell that =2 and if true copy the content of the next column (same row) into another worksheet. I was able to make it work with a simple if statement but I get blank rows when the condition is not met. I want the new worksheet to be a simple list of all the values with no blanks.

    I am hoping I can do this without requiring a macro.

    Hope this makes sense.
    Thanks

  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,723

    Re: Copy content of cell to another worksheet if condition met with no blanks

    Attach a sample workbook (the FAQ describes how to), so we can see how your data is laid out.

    Pete

  3. #3
    Registered User
    Join Date
    03-29-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy content of cell to another worksheet if condition met with no blanks

    test.xlsx

    See the attached simplified example. I am trying to use the content of Column E in the worksheet "datasheet". If the content of Column E is =2 then I want to paste the content of Column F into the new worksheet to get a list. But I don't want any blanks in Sheet1.

  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,723

    Re: Copy content of cell to another worksheet if condition met with no blanks

    The matching column seems to be F in your example file, so put this formula in cell A5 of the datasheet:

    =IF(F5=2,MAX(A$4:A4)+1,"-")

    then copy down to the bottom of your table. Then put this formula in, say, cell A2 of the other sheet:

    =IFERROR(INDEX(Datasheet!G:G,MATCH(ROWS($1:1),Datasheet!A:A,0)),"-")

    and copy that down as far as you think you need it (until you get hyphens showing).

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    03-29-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy content of cell to another worksheet if condition met with no blanks

    Thanks Pete,

    That seems to have solved it for me. I had to modify it slightly for the correct columns but otherwise it was perfect.

    Christina

  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,723

    Re: Copy content of cell to another worksheet if condition met with no blanks

    Well, that's good to hear - glad to be able to help.

    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

  7. #7
    Registered User
    Join Date
    03-29-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy content of cell to another worksheet if condition met with no blanks

    Thanks again. I set this to solved and I believe I was able to add to your reputation. Thanks for the fast help.

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

    Re: Copy content of cell to another worksheet if condition met with no blanks

    You're welcome, and thanks for tidying up the thread. Come back anytime.

    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. Copy table content from Word with condition of a certain cell to excel workbook
    By Exvbassist in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-09-2014, 08:12 AM
  2. check each cell for certain condition, copy the content in a new worksheet
    By cyin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2012, 09:49 PM
  3. VBA: Copy cell content to another worksheet + criteria
    By PBMClubber in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2010, 09:40 AM
  4. copy partial cell content (with condition)
    By soak614 in forum Excel General
    Replies: 3
    Last Post: 06-26-2010, 05:11 AM
  5. Replies: 3
    Last Post: 06-10-2008, 09:20 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