+ Reply to Thread
Results 1 to 18 of 18

Search for Values that meet a Criteria and Paste Location in a New Sheet

  1. #1
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Search for Values that meet a Criteria and Paste Location in a New Sheet

    Hello Experts!

    This is my first post after almost half a year reading and learning many Excel Features in VBA by myself, thanks to this awesome Forum.

    I have the following Problem that I would like to solve. I have already searched through current threads and have not find a solution and my Knowledge is not enough to even define how I could start.

    I have a sheet (attached to this threat) with Solar Panel names and Date with times and I would like to do the following: to search for all values that are less than 2,5 and in a new sheet paste the Name of the Solar Panel and at what times it had this value less than 2,5. This is thought to be done once a month so we can reclaim Warranty to the Panel manufacturer and/or sent technicians to check if Panels are correctly wired. Could someone help me with a VBA Code that could do such?

    Thank you very much in advance, having this would done would mean a lot to me and to my chances of staying at the Company, since now I am just a working Student.

    Jorge
    Attached Files Attached Files
    Last edited by jorgeflores; 10-26-2017 at 06:12 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Try
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Hi

    You can achieve it without VBA, if you use the Get & Transform feature on the Data tab to Unpivot your data.
    Select From Table
    Within the Query editor which then opens
    Select first column > Transform > Unpivot Other columns
    Name column 2 Panel
    Home tab > Close and Load > New Table

    Your data is now in a Format where you can just Filter to show values <2.5

    If you add more data, just refresh the Query on the new sheet

    File attached
    Attached Files Attached Files
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  4. #4
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Hello jindon,

    That is exactly what I was looking for, however I still have a question which was not mentioned in the beginning.
    Is it possible to have a comparison reference (an average value) for every line?
    What I would like to get is the Name of the Panels and the Date/Time for those that were below 25% of the average value of each line.

    Attached you can find the file with the average at the end of each line.

    Thank you very much again jindon, I am trying to understand and interpretate the Code as I use it.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Hello Roger,

    It is good to know also how to do it without VBA, I am giving it a try now. However as final solution I will rather utilize VBA because the Intention is for the End Users to have as less Access to the Information as possible.
    The good Thing is I learned something new today!

    Jorge

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    In that case, row 6 is the one below 2.5, Date/Time = 2017/9/2 19:00, what comes to the Panel name in the result?

  7. #7
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    jindon,

    I did not understand the question, I am sorry.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    OK, what do you expect for the result from then data in Results for Current?

    Panel Name Date and Time

    in Not Working Panels sheet.

  9. #9
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Exactly, just the same result as in the first question; but only if the value is smaller than 25% of the average for each line.
    Last edited by jorgeflores; 10-25-2017 at 09:24 AM. Reason: Syntaxis Error

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Can you just show me the result that you want?

    I just don't understand how exactly you want the result, specially col.A(Panel Name) in the result.

  11. #11
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    I did it manually and you can see it in the file again.

    Each line has to have an average at the end.

    If the value in a line is smaller than 25% of the average of its corresponding line (I marked the values that fulfill this condition in red), then show in a new sheet the Panel Name and Date/Time that corresponds to that value.

    For example:
    if the value is in C2, then the Panel Name will be C1 and the Date/Time A1.
    if the value is in D3, then the Panel Name will be D1 and the Date/Time A3.
    if the value is in B6, then the Panel Name will be B1 and the Date/Time A6.

    I hope it is more clear now.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    OK, do you need Average & 25% Average columns?
    Anyway the code calculates both and populate the results, so see attached.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Yes, the ideal would be to have both the average of the line and also the 25% of that average, so the reference value can be seen.

    I tried with the Code that you posted, however it does not seem to work properly, it always gives me the same three values on the "Not Working Panels" Sheet, regardless if there is even an average showed or not.

    I am sorry to be such a pain, I am trying to be as clear as possible but also understand as much as I can from what you send me.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Can you upload a file that is not working properly?

  15. #15
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    Attached is a file that is not working properly, it shows me the Panel Name and Time for a value that is not below 25% of the average.

    Thank you
    Attached Files Attached Files
    Last edited by jorgeflores; 10-25-2017 at 11:03 AM. Reason: Forgot attachment

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    It should work if you remove last 2 columns from Results for Current,

    If you always have Average/25% Average columns, then change to
    Please Login or Register  to view this content.
    Note: Formula in you latest file in Average is wrong.

  17. #17
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    As usual jindons excellent coding did work but was using the CurrentRegion which included the the average and percentage columns. These columns upset the code

    Change temporarily to and jindon will probably provide a solution later

    Please Login or Register  to view this content.
    already has lol
    Last edited by nigelog; 10-25-2017 at 12:11 PM.

  18. #18
    Registered User
    Join Date
    03-16-2017
    Location
    Hamburg, Germany
    MS-Off Ver
    2016
    Posts
    44

    Re: Search for Values that meet a Criteria and Paste Location in a New Sheet

    I tried it and works perfectly and does exactly what I needed.
    I really appreciate your help, this will save tons of hours yearly.

    Thank you!

+ 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. [SOLVED] Conditional Paste - Only paste in columns that meet criteria.
    By chris01252 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2015, 02:33 PM
  2. Search for criteria in a column, cut and paste row to next empty row in new sheet
    By cath1509 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-25-2014, 07:50 AM
  3. Search row with criteria in all sheet, copy rows and paste in new created sheet
    By dekueb in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-24-2013, 01:42 PM
  4. Search a column for a certain criteria and cut and paste in new sheet.
    By awagenhurst in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-19-2012, 02:23 PM
  5. Replies: 9
    Last Post: 01-22-2012, 01:31 PM
  6. Replies: 7
    Last Post: 09-13-2011, 12:04 PM
  7. Replies: 5
    Last Post: 09-06-2011, 10:44 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