Calculating Numbers

John 4348

Board Regular
Joined
Apr 21, 2022
Messages
78
Office Version
  1. 2010
Platform
  1. Mobile
Hello everyone.
In last Post,I wrote:
On sheet 1, row A2:D2, l have numbers A2= 17, B2=97, C2= 18, D2=19, and in E2 I've written the Formula: (A2+B2*2+C2+D2*4)/8.
However, I need a formula that can supplant D2 for B2 when B2=97.

Now, l want to change it like this: if A2=97, B2=97,C2=18 and D2=19.
What's the Formula?
 
I need a formula that can supplant C2 for A2 & D2 for B2 when A2 & B2=97.
So
The way you have written the above - then all you say when BOTH A2 AND B2 = 97 , But your formula is Either A2 OR B2

if B2 =97 - Change D2 in the formula to B2 = (A2+B2*2+C2+D2*4)/8. becomes (A2+B2*2+C2+B2*4)/8
if A2 =97 - Change C2 in the formula to A2 = (A2+B2*2+C2+D2*4)/8. becomes (A2+B2*2+A2+D2*4)/8
if both A2 =97 and B2 = 97 then = (A2+B2*2+C2+D2*4)/8. becomes (A2+B2*2+A2+B2*4)/8

IF( AND(A2=97, B2=97) , (A2+B2*2+A2+B2*4)/8, IF( A2=97 , (A2+B2*2+A2+D2*4)/8 , If( B2=97 , (A2+B2*2+C2+B2*4)/8 , A2+B2*2+C2+D2*4)/8 )))

Just using (A2+B2*2+C2+D2*4)/8. with A2= 97, B2=97, C2= 18, D2=19, the result is 48.125
NOTE as i said in the 1st post excel calculates a specific way - NOT left to right BUT certain things first in order
(Parentheses, Exponents, Multiplication, Division, Addition, Subtraction)
SO
(A2+B2*2+C2+D2*4)/8
NOT left to right
is NOT A2+B2 = 97+97 = 194
X 2 = 388 etc

BUT 97*2 first = 194
and then 19*4 = 76
Now add those up as in brackets
97+194+18+76 = 385
now divide by 8
48.125

IF we change D2 to B2 AND C2 to A2 we have

(A2+B2*2+A2+B2*4)/8
So first we do the mulitplcation
B2*2 = 97*2
B2*4 = 97*4
then ADD A2 and A2 = 97
776
divide by 8
=97

which i have in E2

Book4
ABCDE
1
29797181997
3
Sheet2
Cell Formulas
RangeFormula
E2E2=IF(AND(A2=97,B2=97),(A2+B2*2+A2+B2*4)/8,IF(A2=97,(A2+B2*2+A2+D2*4)/8,IF(B2=97,(A2+B2*2+C2+B2*4)/8,A2+B2*2+C2+D2*4)/8))
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Book4
ABCDE
1supplant C2 for A2 & D2 for B2 when A2 & B2=97.
29797181997
3179718199.64
4
5supplant A2 for C2 & B2 for D2 when A2 & B2=97.
69797181918.75
7179718192.33
Sheet2
Cell Formulas
RangeFormula
E2:E3E2=IF(AND(A2=97,B2=97),(A2+B2*2+A2+B2*4)/8,IF(A2=97,(A2+B2*2+A2+D2*4)/8,IF(B2=97,(A2+B2*2+C2+B2*4)/8,A2+B2*2+C2+D2*4)/8))
E6:E7E6=IF(AND(A6=97,B6=97),(C6+D6*2+C6+D6*4)/8,IF(A6=97,(C6+B6*2+C6+D6*4)/8,IF(B6=97,(A6+D6*2+C6+D6*4)/8,A6+B6*2+C6+D6*4)/8))
 
Upvote 0
Solution
Book4
ABCDE
1supplant C2 for A2 & D2 for B2 when A2 & B2=97.
29797181997
3179718199.64
4
5supplant A2 for C2 & B2 for D2 when A2 & B2=97.
69797181918.75
7179718192.33
Sheet2
Cell Formulas
RangeFormula
E2:E3E2=IF(AND(A2=97,B2=97),(A2+B2*2+A2+B2*4)/8,IF(A2=97,(A2+B2*2+A2+D2*4)/8,IF(B2=97,(A2+B2*2+C2+B2*4)/8,A2+B2*2+C2+D2*4)/8))
E6:E7E6=IF(AND(A6=97,B6=97),(C6+D6*2+C6+D6*4)/8,IF(A6=97,(C6+B6*2+C6+D6*4)/8,IF(B6=97,(A6+D6*2+C6+D6*4)/8,A6+B6*2+C6+D6*4)/8))
Thank you.
 
Upvote 0
you are welcome
I assume that has now solved the problem for you

IF not , let us know
 
Upvote 0
I assume that has now solved the problem for you
Me too. Therefore, I switched the marked solution post as it is supposed to be.

@John 4348 - in the future, please mark the post as the solution that answered your question instead of your feedback post as it will help future readers much better that way.
 
Upvote 0
Me too. Therefore, I switched the marked solution post as it is supposed to be.

@John 4348 - in the future, please mark the post as the solution that answered your question instead of your feedback post as it will help future readers much better that way.
Alright. Thank you.
 
Upvote 0

Forum statistics

Threads
1,216,112
Messages
6,128,901
Members
449,477
Latest member
panjongshing

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