Summing non-contiguous cells with conditions?

LolSA

New Member
Joined
Aug 18, 2011
Messages
3
Hi, I'm new to the forum, but I have read through many of the threads here while trying to figure out how to write a formula to get the results I need. I hope you will be able to help me get there!

I am running Excel 2003 at work. I sometimes work on this project at home where I have Excel 2010 and Windows 7.

I have the following report spreadsheet that users enter data into:

Excel Workbook
ABCDEF
5Lab 1Lab 2Lab 3Lab 4
62011JanNYNN
7FebNNNN
8MarNNNN
9AprNNNN
10MayYNNN
11JunNNNN
12JulNNNY
13AugNNNN
14SepNNNN
15OctNNNN
16NovNNYN
17DecNNNN
EVP Inspection
Excel Workbook
ABCDEFG
4Lab 1Lab 2Lab 3Lab 4Corp Totals
5JanRating-1000500--10001
6FebRating-1000-1000--10000
7MarRating-1000-1000--10000
8AprRating-1000-1000-1000-10000
9MayRating500-1000-1000-10001
10JunRating-1000-1000-1000-10000
11JulRating-1000-1000-10005001
12AugRating-1000-1000-1000-10000
13SeptRating-1000-1000-1000-10000
14OctRating-1000-1000-1000-10000
15NovRating-1000-1000-1000-10000
16DecRating-1000-1000-1000-10000
17
18SEI by Facility500500-10005003
Excel 2010 Basically, the lab is required to have annual inspections with the user entering "Y" or "N" depending on whether this was completed in a particular month or not. Then I have a second spreadsheet which calculates the score (+500 points for completing the inspection during that month and -1000 for not doing so) EVP Inspection (2)
Excel 2010
Cell Formulas
RangeFormula
C5=IF('EVP Inspection'!C6=""," - ",IF('EVP Inspection'!C6="Y",500,-1000))
C18=MAX(C5:C17)



Now, I only want the lab to receive -1000 only if the lab did not perform an inspection at all in the year, but also see which month the inspection was performed. I have gotten around this in the last line by using MAX.

However, there is a 3rd spreadsheet that draws on this one.

Excel Workbook
ABCDEFG
6Lab 1Lab 2Lab 3Lab 4Corp Totals
138
139DecSM----0.00
140SJI----0.00
141SGI----0.00
142SVPI0.00
143SD----0.00
144SHC----0.00
145SII----0.00
146ST0.000.000.000.000.00
147SLT0.000.000.000.000.00
148
149Overall SI by Facility0.000.000.000.000.00
150
151Overall Annual SI0.000.000.000.000.00
OVERALL
Excel 2010
Cell Formulas
RangeFormula
C149=SUM(C139:C148)
C151=SUM(C17,C29,C41,C53,C65,C77,C89,C101,C113,C125,C137,C149)




It takes the data from the 2nd spreadsheet and several others and adds them to produce an overall monthly score.

However, and yes, I have finally reached the point :) I then need it provide me with an annual total for each lab. But I need it not to add all the totals as I had before I added this sheet, because as you remember, each lab gets 500 for completing, whereas if I add it as is, it will return a score that is out by -10 000! :eeek: I have tried various formulae, all with little or no success. I need it to add all the totals for everything else normally, but if there was any month where the inspection was completed, I need it to only add 500, and if no inspection was performed, add -1000 (not 12*-1000).

In fact, now that I think about it, ideally, I would like the monthly scores to give me -1000 until such a time as a 500 was scored, and then every month after that should also receive 500, as the inspection was carried out, so they do not get penalised thereafter.

I have exhausted the Help function in Excel and I am at my wit's end! I think that I cannot see the woods for the trees anymore with respect to this and I am hoping that there is a really simple solution that I have missed.

I have tried to be as thorough and clear as I can be, but if I need to clarify anything, please let me know.

Thanks! :)
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the Board!

I'm guessing the lack of response to your question is that it is a bit hard to follow. The formula will probably be pretty simple if you can distill the question down to:

Your starting point (for example.. your first screen shot with the Y/N).
Your desired final result (mockup OVERALL without the actual formulas).

Also please clarify:
Do you need to have the intermediate "EVP Inspection (2)" worksheet for other purposes, or could this be eliminated if there is a simple way to get from EVP Inspection to OVERALL?
 
Upvote 0
Hi Jerry!

Yes, in hindsight, it was rather confusing. Thank you for the tips!

I would prefer to keep the intermediate spreadsheet, but I think that there is a more logical way of doing this.

Ok, let me try it this way.

I have the spreadsheet that users enter the information to:

Excel Workbook
ABCDEF
5Lab 1Lab 2Lab 3Lab 4
62011JanNYN
7FebNNN
8MarNNN
9AprNNNN
10MayYNNN
11JunNNNN
12JulNNNN
13AugNNNN
14SepNNNN
15OctNNNN
16NovNNNY
17DecNNNN
EVP Inspection
#VALUE!
Excel 2010




Then for the "Overall" monthly totals, I would simply link to the relevant cells in EVP Inspection (2).

I hope that is clearer?

Thanks again!
 
Upvote 0
Try this in EVP Inspection (2)

C5
=IF('EVP Inspection'!C6="Y",IF(COUNTIF(C$4:C4,500)=0,500),IF(AND('EVP Inspection'!C6="N",COUNTIF(C$4:C4,500)=0,COUNTIF(C$4:C4,-1000)=0),-1000,"-"))

copy across till F5 and down till row 16

HTH

M.
 
Upvote 0
Re-reading your OP i have a question:

Is possible two inspections in the same year? If so should the formula assign 500 for each one?

In this case use this in C5

=IF('EVP Inspection'!C6="Y",500,IF(AND('EVP Inspection'!C6="N",COUNTIF(C$4:C4,500)=0,COUNTIF(C$4:C4,-1000)=0),-1000,"-"))

M.
 
Upvote 0
Hi Marcelo

Yes, it is possible, if unlikely, so...

That's it! :-D

Thank you so so so much!!!!!

I had tried a vaguely similar formula in the beginning, but couldnt manage to figure out the COUNTIF conditions properly. And then I went off on all sorts of tangents that kept getting me further and further away from any semblance of an answer!

Once again, thank you thank you, I appreciate the help!
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,672
Members
452,937
Latest member
Bhg1984

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