# 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.
###### Who is Participating?
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.

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>)
``````
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>))
``````
0
Author 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!
0
Director, 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)
0
So the formula would be:
``````=IF(J27 <= E27, J27*K27, E27 * K27)
``````
0
Director, Information SystemsCommented:
EDIT again:
Are you asking how test different conditions?
=IF(A5>B5, "A", IF(A5<B5,"B", "Equal"))
0
Author 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.
0
Distinguished Expert - 2017Commented:
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
``````
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.
0

Experts Exchange Solution brought to you by

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

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))
``````
0
Author 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.
0
###### 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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.