+ Reply to Thread
Results 1 to 2 of 2

Using macro generated data in general excel formulas

  1. #1
    Registered User
    Join Date
    05-02-2012
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2010
    Posts
    1

    Using macro generated data in general excel formulas

    Ok, a bit hard to explain this, hope someone understand...

    I'm already using a macro to merge data from different Workbooks in a specific folder (same folder as the excel file using the macro is saved). Look further down for the macro I'm currently using.
    The data that is imported to the excel file "holding" the macro is gonna be used as a database. I've tried using different general excel formulas (e.g. Vlookup, SUMIF, SUMIFS), which searching the database built up by using the macro. So far, so good..

    The problem occure when I run the macro again, with a new set of data. The formulas result doesn't change. I guess they don't act dynamically.

    To be a little more specific about what I'm trying to aim (please look at the attachment file):

    In Sheet 2 column 'A' there are different project numbers (e.g. 101323). In Column 'C' (Sheet 2) I would get the total sum from Column 'L' in Sheet 1, based on the following criterium: project number, value in column 'A' in Sheet 2 are > 3000 and < 4000. In the attched example the result would have been 533653.

    I know that I can use the SUMIFS function to solv this, but it doesn't seem to work when the data is generated by a macro. And as metioned already - a new set of data imported doesn't effect the formulas outcome. E.g. say the new set of data doesn't contain the project number "101323", the SUMIFS formlua won't return 0, but still 533653.

    I should also mentioned that the project numers are dynamic, since they are linked to numbers in Sheet 3, column B (but I guess this would not be a problem).

    Do I need a macro to solv this or do I just have to modify the macro I'm already using? Or something else... please help!


    Here's the macro I'm using:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by joesta; 05-05-2012 at 06:36 AM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,960

    Re: Using macro generated data in general excel formulas

    Please read and adhere to these simple rules!

    #3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing.

    Select your code and click the [#] button at the top of the post window

    * (if you are editing an existing post, press Go Advanced to see the [#] button).

    The result will appear like this in the editing window:

    [code]
    your code here ...
    and here ...
    and here
    [/code]

    It will appear like this when posted:

    Please Login or Register  to view this content.
    You can also type the code tags in manually if you prefer.
    Please wrap each Sub..End Sub with a separate [code]-[/code] pair.
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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