SUMPRODUCT formula, need to make additions

Sethomas5

Board Regular
Joined
Oct 5, 2015
Messages
204
Hello and thanks in advance!
I'm using Excel 2013 with Windows 7 Enterprise on a PC.

I am trying to use this formula to see if a course fits in a certain core content category. However, cells have more than one course separated by either a + or a /, like this:

BIO 150 + BIO 151/BSL 215/BIO 141

So, for BIO 150 + BIO 151, I only need to know if "BIO 150" fits in a certain core content category. BUT, then I next need to search for the class (or classes) after the "/".

I am currently using a array that almost works, but if I have more than just, say, BIO 100, I get #N/A, which makes sense, but I don't know how to fix it.

Code:
=INDEX('Sheet1'!$A$1:$C$1,IF(SUMPRODUCT((C4='Sheet 1'!$A:$C)*1)=0,NA(),SUMPRODUCT((C4='Sheet 1'!$A:$C)*1*{1,2,3})))

Sheet 1 looks kind of like this:
ABC
1Natural SciencesOral CommunicationsWritten Communications
2BIO 100ENG 100COM 100
3BIO 151ENG 101COM 101
4BIO 152ENG 102

The course that I am referencing is in another sheet and is in column C (C4 in my example formula).

ABC
1EKU CLASSCLASS NAMEKCTCS CLASS
2BIO 111BiologyBIO 151 + BIO 152/BSL 215
3BIO 112Another BioBIO 152 + BIO 153/BIO 141/BSL 140
4BIO 316Another BioBIO 100
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Not sure exactly what your expected results are... can you post an example of what you want your data to look like?
 
Upvote 0
@svendiamond

Yes! I suppose I should have done that earlier. Sorry, it was almost lunch time.
Here is what I want my data to look like:
ABCD
1EKU ClassClass NameKCTCS Class(es)Core Category
2BIO 111BiologyBIO 151 + BIO 152Natural Sciences
3BSL 215
4BIO 112Another BioBIO 152 + BIO 153Natural Sciences
4BIO 141
5BSL 140
6BIO 316Another BIOBIO 100Natural Sciences
7ENG 100English classENG 101Written Communications
8CMS 100COM classCOM 100Oral Communciations

I want to match the class from column C (KCTCS Class(es)) to one in Sheet 1 and return the header for that column (such as Natural Sciences) in column D on my second sheet.
I'm thinking a different, easier formula, altogether would do this for me.

As you can see from the above table, I'd REALLY like for the classes that are separated by a "/" to be on a new line. I know that would be another formula.
 
Upvote 0
I can probably come up with some code to accomplish your desired results. Are there ever times when there are multiple classes in a single cell in column C?
 
Upvote 0
@svendiamond

I've sorted out two of my problems that I couldn't figure out before. So, my starting data has changed a little, but I think it will be much easier.

Here is an example of my starting data, mind you there can be blanks in Column C (example in row 4) and many many rows.

ABCD
1EKU COURSEKCTCS COURSECORE CATEGORY
2ACC 201NAME OF CLASSACC 201
3ACT 101 + ACT 102
4ACC 202NAME OF CLASS
5QMB 200NAME OF CLASSSTA 220
6ST 291

So, as you can see, right now I have each class in column C that could be equivalent to a class in column A in a separate row.
Now, I just need to be able to fit it into my sumproduct formula to only reference the first 7 characters in Column C.

Here is my formula I am using again:

Code:
=INDEX('Sheet1'!$A$1:$C$1,IF(SUMPRODUCT((C4='Sheet 1'!$A:$C)*1)=0,NA(),SUMPRODUCT((C4='Sheet 1'!$A:$C)*1*{1,2,3})))
 
Upvote 0
I think your formula works fine, however, referring to entire columns may be slowing it down, as it is looking through three million cells... just change it to:

=INDEX(Sheet1!$A$1:$C$1,IF(SUMPRODUCT((C2=Sheet1!$A$1:$C$100)*1)=0,NA(),SUMPRODUCT((C2=Sheet1!$A$1:$C$100)*1*{1,2,3})))

Also, if you want to refer to just the LEFT 7 characters of column C, the fastest and easiest way would be to add a helper column that gets those characters (i.e. =LEFT(C2,7)) and then refer to that column in your formula. You can always hide the helper column.
 
Upvote 0
@svendiamond

Okay, that sounds like it could work. Buuuuut, I'm going to need help creating the helper column and hiding it. Especially the hiding part. I've never done that.

Thanks so much for your help!
And I will definitely edit my formula to make it faster.
 
Upvote 0
@svendiamond

Created/used the =LEFT formula fine. I'm sure I can search these threads to figure out how to hide a column, so thank you SO much for your help!
 
Upvote 0

Forum statistics

Threads
1,217,396
Messages
6,136,375
Members
450,006
Latest member
DaveLlew

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