# Excel Formula

Currently I have a formula: =IFERROR((C2)/(B2-F2-G2-H2-I2-J2),"")
A new requirement has been added, I now need to be able to count for D2 as well.
The problem is that if B2=1 and C2=1, I get 100% which is correct, but if I count D2 as well it will give me 50%. I need to be able do something will only count C2 or D2 but not both. B2 changes based on how many students.

B2 comes from: =COUNTIF('PTA Credential '!A:A,A2)
C2 comes from: =SUMPRODUCT((fm=Counts!A2)*(fm_0=1))
D2 comes from: =SUMPRODUCT((fm=Counts!A2)*(fm_1=1))

If I use:  =IFERROR((C2+D2)/(B2-F2-G2-H2-I2-J2),"") instead of 100% it will be 200% which cant be with only 2 students

I'm in over my head on this. It's probably simple, but I havent worked on Excel for a good while.
Template-20180122.xlsm
LVL 20
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VBA ExpertCommented:
What criteria can be used to determine whether to use C2 or D2?
0
Author Commented:
On the First Sheet (PTA Credential) in the attached sheet, C2 and D2 come from the array based on Columns O and P. The next sheet (Counts) take that info and aggregates those into an overall count.
0
VBA ExpertCommented:
You say want to use either C2 or D2, how would it be determined which to use?

Is there some criteria/logic for that?
0
Author Commented:
That is the issue, both can be used for a total of 2, but the formula should can only count it as if its 1. Either/Or but not both. Does that make sense to you?
0
Author Commented:
The amount of students in the array varies. So if there a 30 students, some may have O2 or P2 or both set as 1on the 1st sheet . The count on the 2nd sheet (COUNTS) - S2  "=IFERROR((C3+D3)/(B3-F3-G3-H3-I3-J3),"") "  should only ever be a max of 100%. That is were the formula comes in. I neglected that in the original write-up.
0
VBA ExpertCommented:
It makes sense to only use one but I don't see any way of determining which one to use.

Is there any logic/reason why one would be used over the other?
0
Author Commented:
Yes, They both have to be counted but only one is used for the count its an Either/Or issue.
0
Finance AnalystCommented:
How about using the MIN function?

=MIN(1,C2+D2)

If C2 and D2 are blank then result of C2 + D2 is zero so MIN options will be zero and 1, result will be 0
If either C2 or D2 are 1 then result of C2 + D2 is 1 so MIN options are both 1, result will be 1
If both C2 and D2 are 1 then result of C2 + D2 is 2 but MIN options are 1 and 2, result will be 1

Hope that helps.
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thank you, I had not even thought to use MIN. This is what I used "=IFERROR(MIN(1,C2+D2)/(B2-F2-G2-H2-I2-J2),"") " and that seems to work well for my issue.
0
Author Commented:
Opps, doesnt work after all. I need some adjustment.  I'll try to reopen.
The formula, does not account for students B2 that do not have a count in them. B2, is derived from this: "=COUNTIF('PTA Credential '!A:A,A2)"
0
Author Commented:
I was able to figure it all out and get it working. I had to use more Arrays and utilized the MIN to help with those. I've attached the Spreadsheet if you want to see what was done. Thanks for your help
TEMPLATE-PTA-Tracking-20180123.xlsm
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.