Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Oct 2014
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Help creating if-then type macro based on data in several cells

    I know how to create a if-then type macro using Case InStr when dealing with text in particular cells. For this macro, I need to code line items based on several different factors- date, amount, and description. Attached is my example:

    Book1.xlsx

    The macro needs to return the info in the Group columns (D and H). I included notes on how each item matches in column I.

    I'm really hoping there is a macro that can accomplish this. I currently have a very large nested formula that is slowing this spreadsheet down. Let me know if you have questions. Thanks in advance!!

  2. #2
    3 Star Lounger Supershoe's Avatar
    Join Date
    Apr 2014
    Location
    Austin, TX
    Posts
    252
    Thanks
    1
    Thanked 36 Times in 34 Posts
    You did not include your formula

  3. #3
    New Lounger
    Join Date
    Oct 2014
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I didn't include the formula because it doesn't have all of the attributes yet and the spreadsheet is already running very slow as there are thousands of lines that need to be grouped. I need a VBA macro to accomplish this and I do not know how to build one that isn't a basic If-Then Case. Column I lists what I need the macro to accomplish.

    Does anyone have experience building something like this?

  4. #4
    3 Star Lounger Supershoe's Avatar
    Join Date
    Apr 2014
    Location
    Austin, TX
    Posts
    252
    Thanks
    1
    Thanked 36 Times in 34 Posts
    Would have helped to, at least, show us your effort(s).
    Let's see if we have the logic
    I want to look at the date in col A and
    if it shows up in col E, then
    if then the amount in col b shows up in col f then

    I see a "selectcase" working for this but you are not exactly clear as to what goes where and why.

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts
    This is doable but is a large undertaking for someone doing it for free. Your specification on what is a match and what isn't is not great so we don't have a good basis for where to begin.

    However, I do think that it could be modularised so that each condition could be addressed separately (breaking down the task into smaller/easier chunks).

    I would load the two tables as two filtered recordsets (removing anything with an existing match). Then you could have a series of functions that searches for each condition and hopefully returns a smaller filtered set of remaining data after each function.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •