Change Sign in a Cell When Another Cell Includes but is not Limited to Certain Text

jdpro

Board Regular
Joined
May 1, 2016
Messages
82
Office Version
  1. 365
Platform
  1. MacOS
Hello 🖐️:)

Using the formula: =IF(J43="buy",M43*-1,M43)

I would like to be able to have "buy" and other text in the reference cell and still have it change the result cell to negative when it sees the word "buy". There will be different "buy" items and it would be great to have it in one column rather than having to add another column to show what is being bought. So can a variable be added to the function?

Thanks!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
If I have a follow-up question on this should I make a new thread? Sometimes there are fees involved and I have to enter "Buy Fees" to get the negative cost. It would be nice if the program could change the result to a negative if the cell in the Action column has "Buy" or if it has "Fees." But I'm not sure if this is a separate question that requires a separate thread.

Thanks as always!
 
Upvote 0
But I'm not sure if this is a separate question that requires a separate thread.
The follow-up is very closely related to the original so fine to continue here.

Try
Excel Formula:
=K43*L43*(1-2*MAX(COUNTIF(J43,"*buy*"),COUNTIF(J43,"*fees*")))
or
Excel Formula:
=K43*L43*IF(OR(COUNTIF(J43,"*buy*"),COUNTIF(J43,"*fees*")),-1,1)
 
Upvote 1
That works well Peter, I entered the first formula that did the trick :) (y)
 
Upvote 0
You're welcome. Thanks for the confirmation. :)
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,210
Members
449,090
Latest member
bes000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top