If a positive number, then multiple with another cell, if.

BooInc

New Member
Joined
Nov 3, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi all,
I'm trying to work out this formula.
ABCD
16.14-2175-338.94
26.611814478.98

So cell D currently is =sum(A*B) but if it is a negative number, I just 0 the cell.
I want it so if cell B is a negative number, then cell D = 0, if it is a positive number, then =A*B.

I've tried with something like this, =IF(B1<0,$A1*B1, 0) but that just equals to -338.94.

Thank you :)
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the MrExcel board!

Try this

22 11 03.xlsm
ABCD
1
216.14-21750
326.611814478.98
Boolnc
Cell Formulas
RangeFormula
D2:D3D2=MAX(A2*B2,0)


BTW, I suggest that you investigate XL2BB for providing sample data & expected results to make it easier for helpers to understand just what you have & where it is and also what you want & where it is to be.
 
Upvote 0
Solution
I've tried with something like this, =IF(B1<0,$A1*B1, 0) but that just equals to -338.94
That idea would work too, but you have the two results the wrong way around. :oops:

22 11 03.xlsm
ABCD
116.14-21750
226.611814478.98
Boolnc
Cell Formulas
RangeFormula
D1:D2D1=IF(B1<0,0,$A1*B1)
 
Upvote 0
Welcome to the MrExcel board!

Try this

22 11 03.xlsm
ABCD
1
216.14-21750
326.611814478.98
Boolnc
Cell Formulas
RangeFormula
D2:D3D2=MAX(A2*B2,0)


BTW, I suggest that you investigate XL2BB for providing sample data & expected results to make it easier for helpers to understand just what you have & where it is and also what you want & where it is to be.

Thank you for the fast reply Peter!
It worked as I needed it too.

And I'll try the XL2BB next time I need help.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0
I note that you have quoted post #2 & said that worked but marked post #3 as the solution. That is fine, but note that the post #3 formula will only be reliable if column A is always positive and it is only column B that can switch between positive and negative.
 
Upvote 0
I note that you have quoted post #2 & said that worked but marked post #3 as the solution. That is fine, but note that the post #3 formula will only be reliable if column A is always positive and it is only column B that can switch between positive and negative.
I did noticed the 2nd post after I replied. I'm going to use post #2. I haven't used the MAX function before, I hope I can use it more.
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,802
Members
449,095
Latest member
m_smith_solihull

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