stumped by my boss...

robd11

New Member
Joined
Mar 13, 2019
Messages
3
Ive been lurking on these boards since I started working and a former boss of mine steered me to the site. you don't know it but many of you have been incredibly helpful over the last 6+ years, so thank you.

boss of mine decided to start a new monthly excel challenge and while I have one way of solving the problem, it is not the more "elegant, simplified" way he does it. it's absolutely killing me and he won't share until someone figures it out...problem is, google and this site are generally how I solve these problems and I can't find exactly what Im looking for...so here I am

its a simple data set (table below showing small example), and the idea is to write a formula in column j that will identify the 4 digit project numbers (B1-G1) that each employee spent >= 50% of their time on. Column I has the answers. Before anyone suggests it, I've already determined that I can CONCATENATE multiple IF statements, but he insists there is an easier way.

let er rip

[TABLE="width: 500"]
<tbody>[TR]
[TD]employee
[/TD]
[TD]1234
[/TD]
[TD]1235
[/TD]
[TD]1288
[/TD]
[TD]1646
[/TD]
[TD]1586
[/TD]
[TD]1975
[/TD]
[TD][/TD]
[TD]answers
[/TD]
[TD]formula
[/TD]
[/TR]
[TR]
[TD]a
[/TD]
[TD][/TD]
[TD]50%
[/TD]
[TD]50%
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1235,1288
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b
[/TD]
[TD][/TD]
[TD]100%
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1235
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]c
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]100%
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1646
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]d
[/TD]
[TD][/TD]
[TD]70%
[/TD]
[TD][/TD]
[TD][/TD]
[TD]30%
[/TD]
[TD][/TD]
[TD][/TD]
[TD]1235
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]e
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]100%
[/TD]
[TD][/TD]
[TD]1975
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]f
[/TD]
[TD]40%
[/TD]
[TD][/TD]
[TD]60%
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]1288
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]g
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50%
[/TD]
[TD]50%
[/TD]
[TD][/TD]
[TD][/TD]
[TD]1646,1586
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

forgive me for not attaching the file, work computer restrictions...
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
If your boss has Office 365, he might be using the Textjoin function.
 
Upvote 0
no unfortunately we live in the stone age and are using office 2010...came across that formula in my search, nifty
 
Upvote 0
you can try PowerQuery add-in for 2010 then

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]employee[/td][td=bgcolor:#5B9BD5]1234[/td][td=bgcolor:#5B9BD5]1235[/td][td=bgcolor:#5B9BD5]1288[/td][td=bgcolor:#5B9BD5]1646[/td][td=bgcolor:#5B9BD5]1586[/td][td=bgcolor:#5B9BD5]1975[/td][td][/td][td=bgcolor:#70AD47]employee[/td][td=bgcolor:#70AD47]Custom[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]a[/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7]
50%​
[/td][td=bgcolor:#DDEBF7]
50%​
[/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td][/td][td=bgcolor:#E2EFDA]a[/td][td=bgcolor:#E2EFDA]1235,1288[/td][/tr]

[tr=bgcolor:#FFFFFF][td]b[/td][td][/td][td]
100%​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]b[/td][td]1235[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]c[/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7]
100%​
[/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td][/td][td=bgcolor:#E2EFDA]c[/td][td=bgcolor:#E2EFDA]1646[/td][/tr]

[tr=bgcolor:#FFFFFF][td]d[/td][td][/td][td]
70%​
[/td][td][/td][td][/td][td]
30%​
[/td][td][/td][td][/td][td]d[/td][td]1235[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]e[/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7]
100%​
[/td][td][/td][td=bgcolor:#E2EFDA]e[/td][td=bgcolor:#E2EFDA]1975[/td][/tr]

[tr=bgcolor:#FFFFFF][td]f[/td][td]
40%​
[/td][td][/td][td]
60%​
[/td][td][/td][td][/td][td][/td][td][/td][td]f[/td][td]1288[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]g[/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7][/td][td=bgcolor:#DDEBF7]
50%​
[/td][td=bgcolor:#DDEBF7]
50%​
[/td][td=bgcolor:#DDEBF7][/td][td][/td][td=bgcolor:#E2EFDA]g[/td][td=bgcolor:#E2EFDA]1646,1586[/td][/tr]
[/table]


Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    UnPivotOC = Table.UnpivotOtherColumns(Source, {"employee"}, "Attribute", "Value"),
    Condition = Table.AddColumn(UnPivotOC, "empl", each if [Value] >= 0.5 then [employee] else null),
    Filter = Table.SelectRows(Condition, each ([empl] <> null)),
    Group = Table.Group(Filter, {"employee"}, {{"Count", each _, type table}}),
    List = Table.AddColumn(Group, "Custom", each Table.Column([Count],"Attribute")),
    ExtractVal = Table.TransformColumns(List, {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text})
in
    ExtractVal[/SIZE]
 
Upvote 0
I can CONCATENATE multiple IF statements, but he insists there is an easier way.

An array formula will return the desired results in separate cells. Excel version 2010 or earlier cannot concatenate a range without VBA/morefunc etc. So maybe try:

Code:
Function condtextjoin(rng As Range, rng2 As Range, rng3 As Range, delimiter As String)
Dim myarray As Variant
myarray = Evaluate("=IF(" & rng.Address & ">=" & rng3.Address & "," & rng2.Address & ")")
condtextjoin = Replace(Replace(Join(myarray, delimiter), delimiter & "False", ""), "False" & delimiter, "")
End Function


Excel 2010
ABCDEFGHIJK
1Limitemployee123412351288164615861975answersformula
250%a50%50%1235,1288
3b100%1235
4c100%1646
5d70%30%1235
6e100%1975
7f40%60%1288
8g50%50%1646,1586
Sheet9
Cell Formulas
RangeFormula
K2=condtextjoin(C2:H2,$C$1:$H$1,$A$2,",")
 
Upvote 0
awesome. so my example doesn't show this but let's say I have an employee who doesn't spend at least 50% of their time on any one project. the custom function returns "False" as it is now, how can I get it to return a blank cell? I've played around with the code with no luck but my macro knowledge is limited.
 
Upvote 0
Try:

Code:
Function condtextjoin(rng As Range, rng2 As Range, rng3 As Range, delimiter As String)
Dim myarray As Variant
myarray = Evaluate("=IF(" & rng.Address & ">=" & rng3.Address & "," & rng2.Address & ")")
condtextjoin = Replace(Replace(Replace(Join(myarray, delimiter), delimiter & "False", ""), "False" & delimiter, ""), "False", "")
End Function


Excel 2010
ABCDEFGHIJK
1Limitemployee123412351288164615861975answersformula
250%a50%50%1235,1288
3b100%1235
4c100%1646
5d70%30%1235
6e100%1975
7f40%60%1288
8g50%50%1646,1586
9h22%5%49%
Sheet1
Cell Formulas
RangeFormula
K2=condtextjoin(C2:H2,$C$1:$H$1,$A$2,",")
 
Upvote 0
Try:

Code:
Function condtextjoin(rng As Range, rng2 As Range, rng3 As Range, delimiter As String)
Dim myarray As Variant
myarray = Evaluate("=IF(" & rng.Address & ">=" & rng3.Address & "," & rng2.Address & ")")
condtextjoin = Replace(Replace(Replace(Join(myarray, delimiter), delimiter & "False", ""), "False" & delimiter, ""), "False", "")
End Function


Excel 2010
ABCDEFGHIJK
1Limitemployee123412351288164615861975answersformula
250%a50%50%1235,1288
3b100%1235
4c100%1646
5d70%30%1235
6e100%1975
7f40%60%1288
8g50%50%1646,1586
9h22%5%49%
Sheet1
Cell Formulas
RangeFormula
K2=condtextjoin(C2:H2,$C$1:$H$1,$A$2,",")
Here is your function as a one-liner...
Code:
[table="width: 500"]
[tr]
	[td]Function CondTextJoin(Rng As Range, Rng2 As Range, Rng3 As Range, Delimiter As String) As String
  CondTextJoin = Replace(Application.Trim(Join(Evaluate("IF(" & Rng.Address & ">=" & Rng3.Address & "," & Rng2.Address & ","""")"))), " ", Delimiter)
End Function[/td]
[/tr]
[/table]
 
Upvote 0
...and the idea is to write a formula in column j...
You were looking for a formula solution, correct? Here is an array-entered** formula that appears to work (assumes Employee names are located in Column A and that no code in Row 1 starts with 0)...

=SUBSTITUTE(MAX(B$1:G$1*(B2:G2>=0.5))&", "&LARGE(B$1:G$1*(B2:G2>=0.5),2),", 0","")

**Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself
 
Last edited:
Upvote 0
I got this as an array that seemed to work for me:

=INDEX($B$1:$G$1, SMALL(IF(B2:G2>=0.5, COLUMN(B2:G2)-COLUMN(A2), ""), 1)) & IFERROR(INDEX( ", " & $B$1:$G$1,SMALL(IF(B2:G2>=0.5, COLUMN(B2:G2)-COLUMN(A2), ""), 2)), "")
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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