+ Reply to Thread
Results 1 to 4 of 4

If statement adding calculations

  1. #1
    Registered User
    Join Date
    10-19-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    23

    If statement adding calculations

    Hello,

    I have a monthly report that I want to create a macro to do the following:

    If column "B" has a certain name, then change column H to be a calculation - the calculation would be =f2*.70. I will have a similar calculation in column I as well, which should be =g2*.70. (in both, where "2" would be the appropriate row)

    But if column B has any other name, leave column H as it is. (It will already be populated with a number that I need to keep.)

    There are 4 names that I will need to use the same calculation for. All of the other rows should not be changed. I am attaching a copy of the spreadsheet with the 4 names highlighted.

    Any help would be greatly appreciated. I hope my intent is clear.

    Thanks!!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,843

    Re: If statement adding calculations

    Is this what you want?
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Registered User
    Join Date
    10-19-2012
    Location
    Virginia
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: If statement adding calculations

    Jacc,

    That's close.

    I don't want to insert new columns. If one of the 4 departments is identified, I want to use the formula (g2*.7 and h2*.7) to calculate the amount instead of the zeros that are in the corresponding fields on columns H and I. (F2*.7 - the value would go in the "Cost with All Rebates - Current" column.) (G2*.7 - the value would go in the "Cost with all Rebates-Prior" column.)

    If one of those departments is not identified, I want to leave the numbers as they are in columns H & I.

    So for Cold Dispensed Bev:

    H should be $ 141.15
    I should be $ 167.92

    I hope that clarifies it some.

  4. #4
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,843

    Re: If statement adding calculations

    A cell can contain either data or a formula, not both (unless you want to manually type in the formulas with data in it in each cell). Adding columns with formulas is usually how tasks like this is done. While it is possible to make a macro that does not insert columns it would be totally overkill for this task, not worth the extra effort if you ask me.
    I have a hard time following your reasoning. If you could take the original workbook and make some calculation examples and some comments of what you want I will try.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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