+ Reply to Thread
Results 1 to 12 of 12

if value of x passes criteria then copy y

  1. #1
    Registered User
    Join Date
    10-26-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    if value of x passes criteria then copy y

    Hi,

    I have a spreadsheet (attached) that shows assessment scores and levels etc. Is what I want it to do is in Sheet 2, Column B2 this would look at Sheet 1, cells I2 - I31 and pick out all of the qualifying data (in this case a level 3a, 3b, 3c, 2a, or a 2b) and list of all the childs names in Sheet 2, Column B2 (in this case child 1 to child 19). Then in Sheet 2, Column C2 this would again look at Sheet 1, cells I2 - I31, this time picking out levels 2c, and so on.

    Is this possible? I know I could just copy and paste names, but this is something that is done for 21 classes, and each class has Reading, Writing, Maths - so 63 sets of data, and this is done half termly. A formula/macros/script to speed this up would be a huge time saver.

    Thanks
    Attached Files Attached Files
    Last edited by Office_Dummy; 10-26-2011 at 08:55 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: if value of x passes criteria then copy y

    Hi,

    You could download Laurent Longre's MOREFUNC.XLL and use the MCONCAT function in B2 would be:

    =MCONCAT(IF(Sheet1!$I$2:$I$31={"3a","3b","3c","2a","2b"},Sheet1!$A$2:$A$31," "),)

    Use Ctrl+Shift+Enter when entering the formula so the resulting formula would be an array formula and look like:

    {=MCONCAT(IF(Sheet1!$I$2:$I$31={"3a","3b","3c","2a","2b"},Sheet1!$A$2:$A$31," "),)}

    If it were me I'd probably try to arrange my data differently and use a Pivot Table with the appropriate qualifying data selected for each option.

    HTH
    Steve

  3. #3
    Registered User
    Join Date
    10-26-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if value of x passes criteria then copy y

    Hi Steve, that works a treat...one question after trying it, is there anyway to set the results in B2 (the names that it pulls through) so that they are displayed one per line in the single cell?

    Thanks

  4. #4
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: if value of x passes criteria then copy y

    Glad it worked for you. You can add 5 spaces at the end of MCONCAT function like below.

    =MCONCAT(IF(Sheet1!$I$2:$I$31={"3a","3b","3c","2a","2b"},Sheet1!$A$2:$A$31," "))

    Again, commit with Ctrl+Shift+Enter.

    HTH
    Steve

  5. #5
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: if value of x passes criteria then copy y

    Sorry, pasted the wrong one in the reply.

    =MCONCAT(IF(Sheet1!$I$2:$I$31={"3a","3b","3c","2a","2b"},Sheet1!$A$2:$A$31," "))


    Steve

  6. #6
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: if value of x passes criteria then copy y

    Okay, it wasn't me looks like once I post it the extra spaces in quotes revert to a single space so I'll put in a b for the space.

    MCONCAT(IF(Sheet1!$I$2:$I$31={"3a","3b","3c","2a","2b"},Sheet1!$A$2:$A$31,"bbbbb"))


    Steve

  7. #7
    Registered User
    Join Date
    10-26-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if value of x passes criteria then copy y

    I have replaced the 5 b's with 5 spaces, this seems to work for all but the first name that is pulled through, before this there are a number of spaces which send the name into the centre of the box, the following names are all down the left side of the box. Is there anything to fix this?

    Thanks

  8. #8
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: if value of x passes criteria then copy y

    I am not experiencing that issue. I've attached my version.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: if value of x passes criteria then copy y

    I just realized this is happening when the first match is not the first item in the list. I'll play around with it and let you know.

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: if value of x passes criteria then copy y

    why are you trying to put all the info in one cell?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  11. #11
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: if value of x passes criteria then copy y

    Put 10 spaces where you have 5. When the first person that meets the criteria is not the first person in the list it will create a blank space above the first name returned. If you can live with that this will work. I tried it using real names with varying lengths and it keeps them aligned. To Martin's point, I'd be curious as to why you need the data in this format? I also think using a pivot table with some filtering and calculated fields might be easier to maintain in the long run.

    Steve

  12. #12
    Registered User
    Join Date
    10-26-2011
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: if value of x passes criteria then copy y

    We have been using this for a few weeks now with no problem. Another school that I deal with has shown an interest in the sheet, however on their machines it doesn't work. They are using Office 2003 and have the MoreFunc Add-In installed.

    I have converted the sheet to a 2003 version and this works fine on my laptop (2007) but when it is opened in 2003, only a few of the names are pulled through.

    Is there anything I can do?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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