+ Reply to Thread
Results 1 to 4 of 4

Multiply cells in two worksheets conidtion is matched and use of looping

Hybrid View

  1. #1
    Registered User
    Join Date
    02-03-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2007-2010
    Posts
    7

    Multiply cells in two worksheets conidtion is matched and use of looping

    Hello friends,
    There are two worksheets in the attached workbook ("CDL" and "ID"). When there is a match between a cell in column A of "CDL" and a cell in column A of "ID", I want to multiply for the same row, column D of "ID" multiplied with column E of "CDL" till the end of data in "CDL". The multiplication result should be in column G of "CDL". Can you please help? Thank you.

    Best regards,
    Tahir
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Multiply cells in two worksheets conidtion is matched and use of looping

    The basic formula in G4 would be:

    =E4 * INDEX(ID!D:D, MATCH($A4, ID!$A:$A, 0))

    ...copy that cell downward.


    If you don't want to see the Not Applicable (#N/A) results for the nonmatches, then:

    =IFERROR(E4 * INDEX(ID!D:D, MATCH($A4, ID!$A:$A, 0)), 0)
    or
    =IFERROR(E4 * INDEX(ID!D:D, MATCH($A4, ID!$A:$A, 0)), "")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-03-2013
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2007-2010
    Posts
    7

    Re: Multiply cells in two worksheets conidtion is matched and use of looping

    Thank you JBeaucaire. It works. You guys are genius in providing a simpler solution. I was thinking on the lines to have two loops (one in each worksheet) to go through row by row to match the cells till the end of data (last row) in each worksheet and get the multiplication result in the desired column. Can it be done that way as well? Can you guide in that way as well (if you can spare a few minutes of your time)? Thank you again.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Multiply cells in two worksheets conidtion is matched and use of looping

    I never do with VBA what a basic formula can do. Others may rise to the challenge, though.

    Is there some non-obvious benefit to using VBA?

+ 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. Need help in looping of Macro between cells and worksheets
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2013, 06:07 PM
  2. Replies: 19
    Last Post: 05-15-2013, 02:54 PM
  3. If criteria match, multiply then sum across multiply worksheets
    By ciayers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2013, 02:20 PM
  4. copy matched data between worksheets
    By stb in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 07-13-2010, 11:27 AM
  5. Macro to loop through all worksheets, pulling a range of cells if criteria matched.
    By strictlydiesel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2009, 12:37 AM

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