Calculating Numbers

John 4348

Board Regular
Joined
Apr 21, 2022
Messages
78
Office Version
  1. 2010
Platform
  1. Mobile
Hello everyone.
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.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Like so

Rich (BB code):
=(A2+IF(B2=97,D2,B2)*2+C2+D2*4)/8
 
Upvote 0
Are you sure your B2 is exactly 97, not just being displayed as 97?
 
Upvote 0
Unfortunately, not correct.
You're going to have be a little more specific if you want further help.

What result are you getting and what result are you expecting instead?

Using the numbers you gave in your post I get 18.625 which is the correct answer.
=(A2+IF(B2=97,D2,B2)*2+C2+D2*4)/8
Evaluates as
=(17 + IF(97=97, 19, 97)*2 + 18 + 19*4)/8
=(17 + IF(TRUE, 19, 97)*2 + 18 + 76)/8
=(17 + 19*2 + 18 + 76)/8
=(17 + 38 + 18 + 76)/8
=149/8
=18.625


$scratch.xlsm
ABCDE
1
21797181918.625
Sheet10
Cell Formulas
RangeFormula
E2E2=(A2+IF(B2=97,D2,B2)*2+C2+D2*4)/8


I need a formula that can supplant D2 for B2 when B2=97
To be clear, I took this to mean "use D2 if B2 is 97, otherwise use B2".
 
Upvote 0
Solution
You're going to have be a little more specific if you want further help.

What result are you getting and what result are you expecting instead?

Using the numbers you gave in your post I get 18.625 which is the correct answer.
=(A2+IF(B2=97,D2,B2)*2+C2+D2*4)/8
Evaluates as
=(17 + IF(97=97, 19, 97)*2 + 18 + 19*4)/8
=(17 + IF(TRUE, 19, 97)*2 + 18 + 76)/8
=(17 + 19*2 + 18 + 76)/8
=(17 + 38 + 18 + 76)/8
=149/8
=18.625


$scratch.xlsm
ABCDE
1
21797181918.625
Sheet10
Cell Formulas
RangeFormula
E2E2=(A2+IF(B2=97,D2,B2)*2+C2+D2*4)/8



To be clear, I took this to mean "use D2 if B2 is 97, otherwise use B2".
That's right.
Well done 👍
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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