Pulling two pieces of info from table into one cell

ExcelGuy12345

New Member
Joined
Feb 1, 2018
Messages
12
Hello All,

Is it possible to enter two pieces of text information into a cell and have it calculate an answer?

For example, I'm trying to make it so an employee can simply punch in a code word for a "job" and have it compile the total time in an adjacent cell. The problem is that I need the ability for him to enter two or more different words into the cell and have it spit out the total calculated time on the other end. I'm trying not to change too much on the sheet so I don't confuse things for him.

Currently, I have a SUMPRODUCT ----=SUMPRODUCT(SUMIF(K2:K4,B2,L2:L4)*C2)---- pointing to a coded table where "Job A" = 5 minutes, "Job B" = 10 minutes, etc. So, all he has to do is enter "Job A" into his cell and it returns a time. However, I need him to be able to enter "Job A/Job B/Job C" and have it add all the times together (in the mentioned formula, the cell would be "B2".)

Also, is there a way to make it so he doesn't have to type in the exact word to get the desired result? Sometimes, there is a typo which makes the key word unrecognizable so the formula doesn't work. I'd like to be able to make it so he doesn't have to type exactly "Job A/Job B" or whatever. I'd like that if he used a "," instead of a "/" or added an extra space somewhere, it wouldn't throw things off.

Thanks for the assistance, and if there's any more information needed, please let me know!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This can be done if the user inputs a consistent delimiter between the job codes, like , or / Also you could build a hidden index table with most common nicknames for the job codes so it could result with jobA or A
 
Upvote 0
Is there going to be a maximum number of job codes the person will enter into cell B2?

If so, I can work on the "test" part which can count how many times the delimiter / is found and then parse the input string.

Code:
=IF(ISERROR(FIND("/",SUBSTITUTE(B2,",","/")))=TRUE,SUMPRODUCT(SUMIF(K:K,B2,L:L)*C2),[COLOR=#ff0000]"test"[/COLOR])
 
Last edited:
Upvote 0
Is there going to be a maximum number of job codes the person will enter into cell B2?

If so, I can work on the "test" part which can count how many times the delimiter / is found and then parse the input string.

Code:
=IF(ISERROR(FIND("/",SUBSTITUTE(B2,",","/")))=TRUE,SUMPRODUCT(SUMIF(K:K,B2,L:L)*C2),[COLOR=#ff0000]"test"[/COLOR])

Thanks for the reply!

Currently, there are only three job codes which need to be entered. So, the maximum entered per cell would look like: "Job A/Job B/Job C". Most instances would only require one of the three, but could also be any two of them. They could be entered in any order.
 
Upvote 0
Well the easiest way would be just to modify your list with the potential iterations.
Job A
Job B
Job C
Job A/Job B
Job A/Job C
Job A/Job B/Job C
Job B/Job A
Job B/Job C
Job B/Job A/Job C
Job B/Job C/Job A
.....
could even add
A
B
C
A/B/C
A/B
A/C
...
But I'll look at doing the delimiter searching part if you still want.
 
Upvote 0
Well the easiest way would be just to modify your list with the potential iterations.
Job A
Job B
Job C
Job A/Job B
Job A/Job C
Job A/Job B/Job C
Job B/Job A
Job B/Job C
Job B/Job A/Job C
Job B/Job C/Job A
.....
could even add
A
B
C
A/B/C
A/B
A/C
...
But I'll look at doing the delimiter searching part if you still want.

That's my current set-up, but it gets a little cumbersome. Thank you for the information about the delimiter, I'll research to see if I can figure what that's all about.
 
Upvote 0
This would process 2 jobs in the cell. Still working on 3 job...


Code:
=IF(ISERROR(FIND("/",SUBSTITUTE(B2,",","/")))=TRUE,SUMPRODUCT(SUMIF(K:K,B2,L:L)*C2),IF((LEN(SUBSTITUTE(B2,",","/"))-LEN(SUBSTITUTE(SUBSTITUTE(B2,",","/"),"/","")))/LEN("/")=1,(SUMPRODUCT(SUMIF(K:K,TRIM(MID(SUBSTITUTE(B2,",","/"),1,FIND("/",SUBSTITUTE(B2,",","/"))-1)),L:L))+SUMPRODUCT(SUMIF(K:K,TRIM(MID(SUBSTITUTE(B2,",","/"),FIND("/",SUBSTITUTE(B2,",","/"))+1,LEN(B2))),L:L)))*C2,"unable to process 3 jobs"))
 
Upvote 0
This would process 2 jobs in the cell. Still working on 3 job...


Code:
=IF(ISERROR(FIND("/",SUBSTITUTE(B2,",","/")))=TRUE,SUMPRODUCT(SUMIF(K:K,B2,L:L)*C2),IF((LEN(SUBSTITUTE(B2,",","/"))-LEN(SUBSTITUTE(SUBSTITUTE(B2,",","/"),"/","")))/LEN("/")=1,(SUMPRODUCT(SUMIF(K:K,TRIM(MID(SUBSTITUTE(B2,",","/"),1,FIND("/",SUBSTITUTE(B2,",","/"))-1)),L:L))+SUMPRODUCT(SUMIF(K:K,TRIM(MID(SUBSTITUTE(B2,",","/"),FIND("/",SUBSTITUTE(B2,",","/"))+1,LEN(B2))),L:L)))*C2,"unable to process 3 jobs"))

That's great!!! It works just how I need it to. I've been banging my head against the desk trying to figure this out. Thanks so much.
 
Upvote 0
Hi,

To avoid entry Typos, possible different delimiters ( , / space nothing etc. e.g. A,B A/B A B AB), which makes it Very difficult to come up with a formula that's guaranteed Not to fail.

This is what I recommend, since there are Only 3 jobs, that means there are Only 7 possible unique combinations (unless the same Job is done more than once, e.g. JobA/A, then the table needs to be updated), I would create a Table (in my sample, E1:F8), Use Data Validation for the Enter Cell (in my sample, B2) as a Drop Down List referencing E2:E8, then use a simple VLOOKUP formula to calculate the Time:

Edit, will repost sample.
 
Last edited:
Upvote 0
Hi,

To avoid entry Typos, possible different delimiters ( , / space nothing etc. e.g. A,B A/B A B AB), which makes it Very difficult to come up with a formula that's guaranteed Not to fail.

This is what I recommend, since there are Only 3 jobs, that means there are Only 7 possible unique combinations (unless the same Job is done more than once, e.g. JobA/A, then the table needs to be updated), I would create a Table (in my sample, E1:F8), Use Data Validation for the Enter Cell (in my sample, B2) as a Drop Down List referencing E2:E8, then use a simple VLOOKUP formula to calculate the Time:

Edit, will repost sample.

OK, here's my sample:


Book1
BCDEF
1Entry HereTimeJob ListTime/Minutes
2JobC15JobA5
3JobA/B15
4JobA/B/C30
5JobA/C20
6JobB10
7JobB/C25
8JobC15
Sheet30
Cell Formulas
RangeFormula
C2=IFERROR(VLOOKUP(B2,E2:F8,2),"")
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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