Change how total is calulated based on contents of cells

MikeyMo

New Member
Joined
Mar 26, 2020
Messages
6
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Hard to title this post, but the issue is as follows:

I have three cells (A1,B1,C1) with scores and a fourth (D1) with the totals.
Cell D1 contains the formula: =(A1* .25) + (B1* .25) + (C1* .5). Simple enough.

However, the requirement is if either A1 or B1 does not contain a score, then the value in A1 or B1 needs to be multiplied by .50 instead of .25. For example, if A1 is null then B1*.50.
Finally, if A1 and B1 are both null, the total will only be calculated using C1, which will always have a score.

I have attached an image of this for reference. Looking for the cleanest way to do this with formulas. VBA is not my strong game but I'd be willing to thrash through it if it works better.

Thanks Folks.
Mikey
 

Attachments

  • Calc.png
    Calc.png
    10 KB · Views: 8

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Is this what you want. I have a confusion.
If both A1 and B1 are Null then what will be the value. I have calculated as C2

Book1
ABCD
1Score OneScore TwoScore ThreeTotal
270908040
3
Sheet2
Cell Formulas
RangeFormula
D2D2=IF(AND(B1="",A1=""),C2,A2*IF(B1<>"",0.25,0.5)+B2*IF(A1<>"",0.25,0.5))
 
Upvote 0
CA, to answer your question...

If A2 and B2 are null, then the calculation will just be C2*.50. C2 is the only constant in the formula. The validation is for A2 and B2.

If A2=Null, then B2*.50
If B2=Null, then A2*.50
Otherwise, if both A2 and B2 have values the formula will remain the same. Basically this - =(A2*0.25)+(B2*0.25)+(C2*0.5)
 
Upvote 0
=IF(AND(B1="",A1=""),C2*.50,A2*IF(B1<>"",0.25,0.5)+B2*IF(A1<>"",0.25,0.5))
 
Upvote 0
Another option
=SUM(A2,B2)*IF(OR(A2="",B2=""),0.5,0.25)+C2*0.5

Fluff.

This is working. I can't make sense of it but it seems to work. =) I need to dig into it and formulate some english around it. =))
 
Upvote 0
It's basically saying that if either A2 or B2 is "" then multiply the sum of A2 & B2 by 0.5, otherwise multiply the sum by 0.25.
If both A2 & B2 are "" then it doesn't matter what you multiply the sum by as it will come to 0.
 
Upvote 0
I am messed up. your query says B1 .. But @Fluff response has no reference to B1 A1...
 
Upvote 0
I am messed up. your query says B1 .. But @Fluff response has no reference to B1 A1...

That was my mistake. My image is correct, but I referenced row one by mistake in my explanation.

Thanks to both of you for the quick turnaround. (y)
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,658
Members
449,177
Latest member
Sousanna Aristiadou

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