+ Reply to Thread
Results 1 to 3 of 3

Wanting to copy cells if condition is met

  1. #1
    Registered User
    Join Date
    12-08-2016
    Location
    Norman, Ok
    MS-Off Ver
    Excel 2013
    Posts
    1

    Wanting to copy cells if condition is met

    I am an HR Director and need a lot of information for my monthly reports. I am wanting to have all of my data on one sheet and make formulas to auto-populate in the other sheets wherever needed.

    An example would be:
    On Sheet one, I would have employee names in column A and training month in column B.
    So on sheet two in a cell, I would like to copy over the employees name if the training month is November.

    Please explain as much as possible the formula.

    Note:I used a month as an example, I have other categories that I cannot put into numerical value.

    I really appreciate this!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,914

    Re: Wanting to copy cells if condition is met

    Welcome to the forum!

    A mock-up of what you are looking for would help.

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    Re: Wanting to copy cells if condition is met

    If you want to build in some flexibility, it would be better to use a helper column in Sheet1 to identify the records that meet the criteria. Suppose you use column H, with this formula in H2:

    =IF(B2="November",MAX(H$1:H1)+1,"-")

    When you copy this down it will set up a series of unique sequential number for those records which match the criterion, and returns a hyphen for those which don't, thus showing where the formula is active. The word November could come from another cell, perhaps a drop-down in cell B1 on the other sheet, in which case the formula would become:

    =IF(B2=Sheet2!$B$1,MAX(H$1:H1)+1,"-")

    The formula can easily be changed to set up some other criteria.

    In sheet2 you would have this formula (e.g. in A2):

    =IF(ROWS($1:1)>MAX(Sheet1!$H:$H),"",INDEX(Sheet1!A:A,MATCH(ROWS($1:1),Sheet1!$H:$H,0)))

    This can be copied down to return the data from column A of the first sheet where there is a number in the corresponding cell of column H. The term ROWS($1:1) will return the value 1 on the first row of the formula, but when the formula is copied down it changes to ROWS($1:2), ROWS($1:3), ROWS($1:4), and so on, which return the values 2, 3, 4 etc. on successive rows. Thus the formula will get the first record, then the second, then the third, and so on. You can change the criteria in the other sheet, but this formula will remain the same.

    Hope this helps.

    Pete
    Last edited by Pete_UK; 12-08-2016 at 12:31 PM.

+ 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 cells if fit condition
    By yoavac in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-10-2015, 05:03 PM
  2. [SOLVED] Macro to copy cells into another column if cells contain a certain condition
    By lsm33000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2014, 02:27 PM
  3. [SOLVED] Wanting to copy cells from one ws to another ws.
    By mtouhig in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-05-2013, 01:35 PM
  4. Copy cells based on a condition
    By ozdemirozgur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2011, 03:08 PM
  5. Locked cells with VBA - wanting ability to filter
    By No.Solutions. in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2011, 05:51 AM
  6. Copy cells by multply condition
    By ccsmith in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-06-2010, 03:02 PM
  7. Copy values to other cells based on condition
    By YippeeKiYay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2009, 04:00 PM

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