+ Reply to Thread
Results 1 to 8 of 8

Macro needed that's similar to IF formula

  1. #1
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    163

    Macro needed that's similar to IF formula

    Good Day Folks

    I'm trying to repair a spreadsheet that has been operated on with an axe as opposed to a scalpel.

    I'm looking for a Macro that will work quite similar to an if forumla, with the caveat being that if the criteria is not met, it does absolutely nothing to the data already in that cell. I will need to run this macro in one column over 2400 rows. What I'm trying to accomplish is if column B contains the text "Left to Bill", I want it to insert a forumla on the same row in Column E. If column B does NOT say "Left to Bill", I want it to leave whatever data is already in that cell on Column E alone and to do nothing to it.

    • Range of cells containing data is A1 to G2405. This data is a mix of numbers and text, as well as some empty cells as well.

    • If Column B contains the text "Left to Bill", I want it to insert the formula =IF(AND(D6>500,(D7-D5)>500),"BILL CUSTOMER","") into column E of the same row. For this formula, the column is static, but the rows are relative. I hope I said that right.

    • Presently, Columns B and C are merged together at any point where "Left to Bill" would be present (as well as a lot of other cell mergings at various places), but I can do a mass unmerge if needed. I'd rather not, but this formula is more important to me than the cosmetics of the cell merging.

    Thanks for your time folks!
    Attached Files Attached Files
    Last edited by OpieWinston; 02-27-2014 at 12:30 PM.

  2. #2
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Macro needed that's similar to IF formula

    You can upload a sample spreadsheet of what you want

  3. #3
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    163

    Re: Macro needed that's similar to IF formula

    It's been attached to the original post.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro needed that's similar to IF formula

    Maybe:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 02-27-2014 at 12:15 PM.

  5. #5
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    163

    Re: Macro needed that's similar to IF formula

    Excel Help Needed.xls

    It's attached to this post as well.

    When I run that macro, it gives me "Run-time error '13': Type mismatch", and when I click debug, it highlights the fourth row. The two drop down boxes at the very top say "General" and "OpieWinston".

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro needed that's similar to IF formula

    Note my last edit at 11:15 - modified due to "Run-time error 13"

  7. #7
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Minnesota
    MS-Off Ver
    Office 365
    Posts
    163

    Re: Macro needed that's similar to IF formula

    Thanks John! Worked perfectly - I'm quite grateful!

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro needed that's similar to IF formula

    You're welcome. Glad to help out and thanks for the feedback.

+ 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: 3
    Last Post: 03-09-2013, 10:23 AM
  2. [SOLVED] macro codes for inserting formula to various similar worksheets
    By rohit43 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-21-2013, 10:17 AM
  3. [SOLVED] Need similar functions in different cells in one worksheet needed.
    By tlfaille in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2013, 05:40 PM
  4. formula similar to vlookup needed?
    By jokeshopbeard in forum Excel General
    Replies: 11
    Last Post: 04-17-2009, 02:37 PM
  5. Array formula or similar needed - Again!
    By BRISBANEBOB in forum Excel General
    Replies: 5
    Last Post: 01-01-2009, 11:24 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