+ Reply to Thread
Results 1 to 6 of 6

minimum values between two tables

  1. #1
    Registered User
    Join Date
    08-26-2008
    Location
    Seattle
    Posts
    3

    minimum values between two tables

    Hi all,
    I am a total newbie in VBA. I tried to do this using Excel functions but I don't think it can be done, I tried writing my own VBA function but iI just don't know enough. Here's the scenario:

    Workbook has two sheets with same sized tables with different values and sometimes text.

    I want to create a table in a third sheet like this:

    - Compare two tables cell by cell. If both cells contain text, print ***** in the new table.

    - If one or both cells contain a number, print the minimum in the third table

    (This is as far as I got with Excel functions)

    Additionally, if this minimum number comes from sheet 1, give the cell a certain color, if it comes from sheet2, give it a different color. (I tried conditional formatting for this but I get an error that other worksheets can not be referenced for conditional formatting).

    I can place the tables in the same locations if needed, but I prefer a function where I can select the ranges to be compared for the new table.

    Any help will be GREATLY appreciated!

    Thanks!

    F

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    See macreo 'Macro1' in attached file.

    Macro compare values in sheets 'shhet1' and 'sheet2' and put the resul in sheet 'sheet3'.

    I hope it can help you.

    Regards,
    Antonio
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-26-2008
    Location
    Seattle
    Posts
    3
    Antonio, thanks so much!! This is very very helpful!

    Since I have multiple tables on the same sheet, how can this macro be modified for the range to be a variable (meaning I select the range). I know I could just define range1, range2 and so on and apply the same code to each range, but selecting the range gives me more flexibility.

    Thanks again!

  4. #4
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hi xplan303ex,

    Perhaps adding the following to the code in the sample workbook might help

    Please Login or Register  to view this content.
    allowing you to type in the range that you wnat
    Hope this helps

    Seamus

  5. #5
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    I modified the macro as you needed. Now you can simply select a range and run the macro: the macro will run only for selected cells.

    Regards,
    Antonio
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-26-2008
    Location
    Seattle
    Posts
    3
    Thank you both! This is great help I appreciate it.

+ 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. Userform's listbox values depending on values on certain matrix
    By Juhanen II in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-19-2008, 08:01 AM
  2. Highlighting intersecting values in two tables
    By wilro85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2007, 06:29 PM
  3. Adding Row Values depending on Corresponding Rows
    By chr5648 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2007, 05:26 PM
  4. Minimum returned based on matching values
    By Prcntrygrl in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-29-2007, 03:01 PM
  5. How to return multiple minimum values
    By jrocchio in forum Excel General
    Replies: 1
    Last Post: 10-20-2006, 05:27 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