formula

Copper Contributor

Trying to put in a formula if column d says sell then column f will be a negative amount

 

 

 

 

 

 

 

dsflajsd

adslknfad;

lkadf;k

BUY

dfd

$ 350.00

lkdsfd

kldf

kljdf

SELL

dfd

$   10.00

dfi

diofd

iodf

BUY

dffew

$   25.50

fdks

dofsd

scddo

SELL

ere

$     9.00

3 Replies
=IF(D2=“SELL”,-F2,F2)

This formula checks if the value in column D is “SELL” and if so, it returns the negative value of column F.
Otherwise, it returns the original value of column F.
You can copy this formula down to apply it to other rows.

I hope this helps.
So I did the formula and got this


BUY dfd $350.00 350
SELL dfd $   10.00 #VALUE!
BUY dffew $   25.50 $   25.50
SELL ere $     9.00 #VALUE!

I see that you have some #VALUE! errors in your results.
This usually means that Excel cannot perform the calculation because of a mismatch in data types. For example, if you have text or blank cells in column F instead of numbers, Excel will not be able to multiply them by -1.
To fix this, make sure that all the cells in column F have valid numeric values.
You can also use the ISNUMBER function to check if a cell contains a number or not.
For example, you can use this formula: =IF(AND(D2=“SELL”,ISNUMBER(F2)),-F2,F2).
This means that if the value in column D is “SELL” and the value in column F is a number, then the value in column F will be negative, otherwise it will be positive.