Calculating a value based on another cell.

Calculating a value based on another cell.


On Column M,  the calculation should be as follows:

I'll use rows 27 and 14 as my example.  

If J27 is less than E27, then multiple J27 *K27 to get the value.

and/or

If  J14 is greater than E14, then multiple E14 * K14 to get value.

See attachment.
C--Users-lfreund-Downloads-COST4.xlsx
LUIS FREUNDAsked:
Who is Participating?

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

x
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.

Shaun KlineLead Software EngineerCommented:
What should the value in column M be if J27 is equal to E27? If greater than E27?
The general formula to use is:
=IF(J27 < E27, J27*K27, <your else/false part here>)

Open in new window

If you need a third value then the formula looks like this:
=IF(J27 < E27, J27*K27, IF(J27 = E27, <your equals part here>, <your greater than part here>))

Open in new window

LUIS FREUNDAuthor Commented:
Ah yes....forgot to include that.

If J27 and E27 is equal then it's J27 * K27.

What's the whole formula for this?  Many Thanks!
Paul MacDonaldDirector, Information SystemsCommented:
Based on the criteria you've given, you want the two numbers to be multiplied any time they aren't equal.  This will give you the result you want, just replace A1 and B1 as appropriate.

=IF(A1<>B1, (A1*B1), "Equal")

EDIT:
Based on your followup comment, you simply want the two numbers multiplied every time, so
=(A1*B1)
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Shaun KlineLead Software EngineerCommented:
So the formula would be:
=IF(J27 <= E27, J27*K27, E27 * K27)

Open in new window

Paul MacDonaldDirector, Information SystemsCommented:
EDIT again:
Are you asking how test different conditions?
=IF(A5>B5, "A", IF(A5<B5,"B", "Equal"))
LUIS FREUNDAuthor Commented:
Hi Shaun,  Thanks but after applying your formula I got some that are not adding up.  Those are highlighted in red, the green ones are good.  See attachment.
C--Users-lfreund-Downloads-COST4.xlsx
ShumsExcel & VBA ExpertCommented:
Hi Luis,

Kindly note your Column E & J is not reading as number completely, I ran below macro to change it to numeric values:
Sub RefreshCellsMultipleRange()
Dim aRange  As Range, cRange As Range, uRange As Range, uCell As Range

Application.ScreenUpdating = False
Set aRange = Range("E10:E" & Cells(Rows.Count, "E").End(xlUp).Row)
Set cRange = Range("J10:J" & Cells(Rows.Count, "J").End(xlUp).Row)
Set uRange = Union(aRange, cRange)
For Each uCell In uRange
    uCell.Formula = uCell.Formula
Next uCell
Application.ScreenUpdating = True
End Sub

Open in new window

Then add below formula in M10:
=IF(OR([@[SSVFC QTY ORD]]="",[@[BASE QTY]]=""),"",IF(OR([@[SSVFC QTY ORD]]<[@[BASE QTY]],[@[SSVFC QTY ORD]]=[@[BASE QTY]]),([@[SSVFC QTY ORD]]*[@[SSVFC UNIT COST]]),([@[BASE QTY]]*[@[SSVFC UNIT COST]])))

Hope this helps.
C--Users-lfreund-Downloads-COST4.xlsm

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
Shaun KlineLead Software EngineerCommented:
A different option is to use the NumberValue function.

This formula handled the numbers that Excel is treating as text:
=IF(K27=0,0,IF(NUMBERVALUE(J27)>NUMBERVALUE(E27),E27*K27,(J27*K27)-H27))

Open in new window

LUIS FREUNDAuthor Commented:
Thank you very much Shums, Paul and Shaun.  

Am I missing something when closing?  In the past I was able to award points but It doesn't give me that option anymore.
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 Office

From novice to tech pro — start learning today.