+ Reply to Thread
Results 1 to 15 of 15

.Find function

  1. #1
    Registered User
    Join Date
    12-18-2014
    Location
    nyc
    MS-Off Ver
    2013
    Posts
    30

    .Find function

    Hi- I am struggling a bit with the find function. I currently have a summary sheet called "Comments" and I have a data sheet called "Data". In my comments sheet, I am showing the following 7 columns (I have an empty column in between each):
    1. Company name (column B)
    2. Type of business (column D)
    3. Date (column F)
    4. Type of business code (column H)
    5. Clientel (column J)
    6. Revenue (column L)
    7. Comments (column N)

    These 7 columns are being populated from the Data tab manually. the Data tab has about 25 columns of data, and I want my VBA to:
    1. look in column 21, which is a column full of formulas, and find every cell with a "yes"
    2. in that same row, grab the information needed above, and place it into the Comments tab.

    The VBA below gets me halfway there... If there are 15 cells in column 21 with the value of "yes", then there should be 15 rows in the Comments tab. I'm having a hard time finding the "yes" in column 2, then placing it in Comments tab, then going to the next "yes" value in column 21 and placing in the next row of the Comments tab. Very hard to follow- I'm sorry. Here is what I have so far:

    Please Login or Register  to view this content.
    Last edited by alansidman; 04-08-2016 at 06:02 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: .Find function

    If you are just copying "yes" to the comments column why can you not use a formula in the comments column?
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: .Find function

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html

    Please read the forum rules and abide by them in the future



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    12-18-2014
    Location
    nyc
    MS-Off Ver
    2013
    Posts
    30

    Re: .Find function

    I'm looking for anything that says "yes" in column 21, and I need to return values in other columns based on multiple criteria. Trust me, I would much rather use a formula (like a vlookup or an INDEX), but i think VBA would work smoother.

  5. #5
    Registered User
    Join Date
    12-18-2014
    Location
    nyc
    MS-Off Ver
    2013
    Posts
    30

    Re: .Find function

    sorry. i will do that going forward

  6. #6
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: .Find function

    Perhaps...
    Please Login or Register  to view this content.
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: .Find function

    Ok

    This is the fast way to do what you want.

    This finds Yes in Column 3 and puts a Yes in Column 5.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-18-2014
    Location
    nyc
    MS-Off Ver
    2013
    Posts
    30

    Re: .Find function

    This hit the nail on the head when it comes to what I'm trying to do, thank you... on small problem... lets say there are 3 "yes" values in column 21:

    row 20, row 40 and row 60 have a "yes" value in column 21... the vba is counting the # of "yes" values correctly, and its returning 3 comments correctly to the comments sheet... however its not taking the values from the offset in rows 20/40/60... rather its taking the values from the offset in rows 1/2/3... i'm not sure what the issue is, because everything below seems to be correct below.

    Does this make sense?

    Quote Originally Posted by mongoose36 View Post
    Perhaps...
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: .Find function

    I'm not sure what would be causing this behavior. It works fine in my test (see attached).

    http://www.excelforum.com/attachment...1&d=1460474277

  10. #10
    Registered User
    Join Date
    12-18-2014
    Location
    nyc
    MS-Off Ver
    2013
    Posts
    30

    Re: .Find function

    very interesting... I just tried yours and it works in your spreadsheet. the only difference between mine and yours is that all of my data is in a table, and some of the values are formulas (but thats covered with LookIn:=xlFormulas). any ideas? I'm still playing around with it... does excel version matter?


    Quote Originally Posted by mongoose36 View Post
    I'm not sure what would be causing this behavior. It works fine in my test (see attached).

    http://www.excelforum.com/attachment...1&d=1460474277

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: .Find function

    No need counting or looping, is there?
    Change all sheet/cell references as required.
    Your explanation lacks information for me so can't be more specific.
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: .Find function

    Quote Originally Posted by rgiglio7489 View Post
    very interesting... I just tried yours and it works in your spreadsheet. the only difference between mine and yours is that all of my data is in a table, and some of the values are formulas (but thats covered with LookIn:=xlFormulas). any ideas? I'm still playing around with it... does excel version matter?
    The addition of a table to my test did not alter the result. There must be something else going on. Perhaps if you could upload the workbook you are working with.

    @jolivanes I agree there are better ways to achieve the desired result, however what you have suggested is not quite what @rgiglio7489 is trying to do. Below is your code with some alterations to do what @rgiglio7489 wants.

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-18-2014
    Location
    nyc
    MS-Off Ver
    2013
    Posts
    30

    Re: .Find function

    See attached... Its taking the 3 "Yes" values, and applying it in column 20 for the first 3 rows... not sure whats going on. Might be a setting? I also had no issue with your spreadsheet when I created a table.
    Attached Files Attached Files

  14. #14
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: .Find function

    I think the code below will deliver the results you are looking for...

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    12-18-2014
    Location
    nyc
    MS-Off Ver
    2013
    Posts
    30

    Re: .Find function

    I haven't tested your new suggestion, but i found a workaround:

    Please Login or Register  to view this content.

+ 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] Can I use FIND function to find specific string in a single cell?
    By bonpara in forum Excel General
    Replies: 2
    Last Post: 10-05-2015, 05:46 PM
  2. If function + Find Function to search for multiple values
    By HabsFan89 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2015, 12:11 PM
  3. add in the parameters to the Find function to only find an exact match.
    By jakeembx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-07-2014, 08:57 AM
  4. [SOLVED] Problem with Find function. Need to find Exact match
    By SMILE in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2012, 07:07 AM
  5. find function doesnt find imported info
    By dscott2479 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-12-2011, 07:11 PM
  6. Replies: 2
    Last Post: 03-30-2009, 04:04 AM
  7. Using find function to find entries in multiple cells
    By stanigator in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2007, 08:45 PM

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