+ Reply to Thread
Results 1 to 8 of 8

comparing rows and columns name

  1. #1
    Registered User
    Join Date
    03-05-2008
    Posts
    23

    comparing rows and columns name

    Hi all,

    I am new to the VBA.I need to help form u ppl.Please find tha attched example workbook.In that i have table 1 and table 2.I need to fill tha values in the table-2 based on the value in the table-1. How do we do that in macro?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199
    For your specific example that is attached, invoke this formula in B16 and copy across to C16 and then down to C18. It should give you the desired results.

    =SUMPRODUCT(--($A$4:$A$9=B$15),--($B$4:$B$9=$A16)*($C$4:$C$9))

    Hope that helps.

  3. #3
    Registered User
    Join Date
    03-05-2008
    Posts
    23
    thanks for ur response.

    How shall i do that in macro?

  4. #4
    Registered User
    Join Date
    03-05-2008
    Posts
    23
    thanks for ur response.

    How shall i do that in macro?

  5. #5
    Registered User
    Join Date
    02-28-2008
    Posts
    3
    Hi

    These are my first thoughts for this problem.

    To implement this is VBA, you can use the ADO or DAO objects and query the table. You can create a Select statment something like

    Select Values from [SheetName$] Where Location like 'Chennai' and Desc like 'Temperature'

    Get the value in the recordset and update them in the required cells.

    Let me know if you need further assistance with this method. There can defintely be a quicker and more flexible way of doing this, but these are my initial thoughts.

    Cheers
    Raja

  6. #6
    Registered User
    Join Date
    03-05-2008
    Posts
    23
    since i am new to VBA. I am not sure about "how to work with ADO objects and query.

    Could u pls help me out in this?

  7. #7
    Registered User
    Join Date
    02-28-2008
    Posts
    3
    Here you go, I have created a function GETVALUES which would take Location and Desc as input and will return you the Value corresponding to it.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-05-2008
    Posts
    23
    thank u very much for ur help

+ 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