Excel 2013 Convert Positive to Negative if another cell contains specific text

I have an Excel (2013) file that lists transactions for our AP team. This report is run on a regular basis by accounts payable.

Column D indicates whether the transaction is "Invoice" or "Credit Memo".

Column I is the transaction dollar amount.

Is there a way that I can convert the transaction dollar amount (Column I) from a positive to a negative number if Column D states "Credit Memo"? It would really only need to be a one time run when the file is opened as the report is generated on a regular basis.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tj aCommented:
You can create a new column that has the original Document Amount values but have this column in place where its not visible e.g column AC. Replace the old column with this formula.

=IF(D2 = "Credit Memo", AC2* -1, AC2)

See the attached file for an example
Wayne Taylor (webtubbs)Commented:
You can use VBA to perform this task....

Sub ConvertCreditMemoAmount()
    Dim cell As Range
    For Each cell In Range([I2], [I2].End(xlDown))
        If cell.Offset(0, -5) = "Credit Memo" Then
            cell.Value = -cell.Value
        End If
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mpsgrpAuthor Commented:
Worked absolutely perfectly. Thank you so much!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.