+ Reply to Thread
Results 1 to 7 of 7

multiplying numbers in two different columns with a loop code

  1. #1
    Registered User
    Join Date
    06-03-2020
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    14

    Smile multiplying numbers in two different columns with a loop code

    Hey guys,

    I work for a machinery company and I import 100 ~ 300+ excels files into 1 single file by using excel power query,

    Each excel file contains a number for (Machines) and 3 numbers for (Parts), I need to multiply the above numbers to calculate the total purchase amount.

    Please refer to the picture below:
    excel 3.png

    Each color represents a different excel file(all files are in the same format), the best way I can come up with is to write a code for each excel file:

    D3=$B$2*$A3
    D4=$B$2*$A4
    D5=$B$2*$A5

    D8=$B$7*$A8
    D9=$B$7*$A9
    ............etc

    There are more than 2000+ lines and it would take too much time to write a code for every single column,

    I'm wondering if there is a way to use loop for excel to select the respective columns that need to be multiplied and stop when it reaches the bottom of the worksheet.

    I have been looking for a solution for days and still can't figure out a way to do it as I'm new to VBA.

    I would really appreciate your help, thanks
    Last edited by blackragon; 06-03-2020 at 12:23 PM.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: multiplying numbers in two different columns with a loop code


    Hi,

    yes it's doable, at beginner level …

  3. #3
    Registered User
    Join Date
    06-03-2020
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    14

    Re: multiplying numbers in two different columns with a loop code

    Hi, Marc

    Thanks for your reply, well then I guess I'm worse than beginner level

    could you please give me some hint as to how to do it??

    Thanks!

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: multiplying numbers in two different columns with a loop code


    Follow first the top page yellow banner !

    Without any color if the worksheet is smart enough …

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,107

    Re: multiplying numbers in two different columns with a loop code

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  6. #6
    Registered User
    Join Date
    06-03-2020
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    14

    Re: multiplying numbers in two different columns with a loop code

    Hi, Mumps1

    I tried it and it works perfect, there is no way I could have figured this out myself,

    Thank you so much for helping, I will try to understand what each code stands for
    Please take the star Thank you so much !! really appreciated!!

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,107

    Re: multiplying numbers in two different columns with a loop code

    You are very welcome and thanks for the rep.

+ 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. Replies: 2
    Last Post: 12-12-2018, 05:00 AM
  2. Multiplying columns with omitting negative numbers
    By nirmishkb in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-15-2018, 01:28 AM
  3. [SOLVED] Code for multiplying two columns
    By HonestlyUgly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2018, 08:05 PM
  4. Replies: 5
    Last Post: 01-06-2014, 03:31 PM
  5. Replies: 6
    Last Post: 04-27-2013, 05:54 PM
  6. Multiplying columns of numbers
    By Electra13 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-06-2008, 08:31 AM
  7. Multiplying 2 columns- one with numbers only, one with a number &
    By Kel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2005, 03:05 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