+ Reply to Thread
Results 1 to 7 of 7

Search value in range and add results

  1. #1
    Forum Contributor
    Join Date
    07-22-2012
    Location
    Spain
    MS-Off Ver
    Excel 2008
    Posts
    304

    Search value in range and add results

    Hello,

    I was trying to build up a code similar to the LOOKUP formula but cannot manage to do it cause the answer should add all the values that matches the condition and dont know how to do it...
    I have attached an example with a small table explaining better myself of what I need.

    I would appreciate any help.

    Many thanks!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Search value in range and add results

    Hi

    Try this Formula in the Cell J8 Drag it to fill the range down
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Search value in range and add results

    There may be more involved in this solution than
    a simple formula can fix. Here is the formula to
    put in column J row 8.
    Please Login or Register  to view this content.
    and you would change the "28" to whatever your last
    data row number is.

    It could be that you would like to automate this further
    with VBA code to make you job easier when the worksheet is
    revised. Here is that code.
    Please Login or Register  to view this content.
    Last edited by xLJer; 09-03-2012 at 07:08 PM. Reason: clarification

  4. #4
    Forum Contributor
    Join Date
    07-22-2012
    Location
    Spain
    MS-Off Ver
    Excel 2008
    Posts
    304

    Re: Search value in range and add results

    Hi xLJer

    Works really good!! I finally decided to do it with VBA cause I want to keep clean of formulas the worksheet. Actually I was trying to use your same code but without putting the formula onto the cell.
    Cannot manage replace that formula into a code. The only thing I could do is to continue after that a code in which copy the values and then paste them as a value and not formula...

    Maybe you know a better way...

    Thanks once again!!

    Regardss

  5. #5
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Search value in range and add results

    Here's one way to replace the formulas with values.
    Add the code that I've put in red font.
    Please Login or Register  to view this content.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Search value in range and add results

    Hello Pezalmendra,

    This macro is based on the data and layout of your posted workbook. This VBA macro may better suit your needs.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Forum Contributor
    Join Date
    07-22-2012
    Location
    Spain
    MS-Off Ver
    Excel 2008
    Posts
    304

    Re: Search value in range and add results

    Great! Thanks a lot both of you for your help.
    Got now the code as I wanted!!!


+ 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