Home

Excel formula help

prr924
Occasional Contributor

I'd like to create a formula that either sums columns D2 through H2 OR D2-G2 plus I2. In other words, for the second option I want it to skip H2. Can this be done and if so how do I do it? Screen shot attached.

21 Replies

That could be

=SUM(D2:CHOOSE(<skip H2?>+1,I2,G2))

where <skip H2?> is formula/value for your logical condition

 

Sorry, that didn't work. Let me try to explain this better. I want a formula for cell C2 (Total Score) that does this:

IF H2>0, then C2 =SUM(D2:H2).

If H2<1, then C2 =SUM(D2,F2,G2,I2). 

could you please clarify, if

H2=0.5

H2=1

 

what it'll be in such cases

Hello,

I'm sorry but are you  aware that IF H2=0.5 ( or 0.2, ...) the two conditions are accepted ?

they intersect!

 

 

H2 will always be a whole number. If H2=1 (or greater), then C2 should =SUM(D2:H2).

 

 in this case you can try this:    =IF(H2>0,SUM(D2:H2),D2+F2+G2+I2)

Ahmad, the formula you gave me ALMOST works, but for some reason A student who chooses option 2 comes out at a 90 instead of 100. See attached.

Hmm...this seems to work!!! Wow, thank you so much!!

@prr924  You are welcome 

Oops, I spoke too soon. It still doesn't work. See screenshot attached. Test Student Option 2 should be a 100. The next row down is a real world (not perfect) score and should be an 82 but it's scoring out at 74. 

Another variant is

=SUM(D2:I2)-E2*(H2=0)

 

I know this stuff is way beyond my basic skill set, but why would I want to subtract the value from E2?

Since based on your requirement if H2=0 you sum


@prr924 wrote:

then C2 =SUM(D2,F2,G2,I2). 

other words all from D2 to I2 but E2 and H2.

H2 is zero under this condition, thus you need to substruct only E2 from full sum.

I skipped your latest sample, it looks like you sum D2:I2 independently of H2. What is your exact logic?

try the formula below:

 

=IF(H2>0,SUM(D2:H2),SUM(D2:I2))



 

If I use this formula 

=IF(H2>0,SUM(D2:H2),SUM(D2:I2))

that gives a total score of 100 for all three rows. 

 

This is an assignment that has two options. Students can either write a paper on a finished research project (option 1: scored in column H) or they can write a paper presenting 2 hypotheses and a research plan (option 2: scored in columns J-L which are then summed in column I). They will have a score in column H or column I, never both. 

 

All students, regardless of which option they choose, will have some points in columns D-G that need to be included in their total score. 

 

Maybe this just can't be done? 

Sergei, I don't want to delete E2--there should always be points in columns D-E, plus points from either H or I (not both). Removing E2 from your formula leaves 

 

=SUM(D2:I2)*(H2=0) results in a score of 0 for Test Student Option 1 

=SUM(D3:I3)*(H3=0) results in a score of 100 for Test Student Option 2

 

Both should be 100. 

please find the attached 

If only one or the other of H2 or I2 has a non-zero value, i.e., a student could't have marks in both Option 1 and Option 2, then just using the formula 

 

=SUM(D2:I2)

 

should always work.

Ahmad, you rock!! Thank you so much. Wow, that's so elegantly simple but I could not figure it out for myself. 

you are welcome
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
16 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
11 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies