+ Reply to Thread
Results 1 to 2 of 2

Macro to aggregate if matching

  1. #1
    Registered User
    Join Date
    United States
    MS-Off Ver
    Excel 2007

    Cool Macro to aggregate if matching

    A friend asks me this... I'm unsure of an answer, except repetitive IF statements.

    I'm writing a macro that I can use to take comments from 4 separate worksheets and dump them in labeled row in the same cell.

    E.g., sheet 1 cell(1,2) comments + sheet 2 cell(1,2) comments, etc with line breaks so it doesn't all run together.

    Got that working pretty flawlessly, except that these sheets are from weekly reports, and sometimes the week-to-week status doesn't change.

    I want to write a conditional function that does the following

    if Sheet 1 cell != Sheet 2 Cell
    then aggregate sheet cell = sheet 1 + sheet 2
    if sheet 2 cell != sheet 3 cell
    then aggregate sheet cell = aggregate sheet cell + sheet 3 cell

    is there any way to do this without obnoxious, repetitive if/then statements?

    Is there anything available in VBA that is equivalent to the Case function from Java?

  2. #2
    Forum Expert
    Join Date
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007

    Re: Macro to aggregate if matching


    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed/changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.
    Have a great day,

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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


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