Complex Concatenation

redhots4

Board Regular
Joined
Aug 30, 2004
Messages
136
Office Version
  1. 365
Platform
  1. MacOS
In the example below, the user will define the Role and a % for each. (The Role and % will later be used to calculate hour allocations for project tasks, similar to MS Project.)

In a single cell, I want to summarize the Role/% information entered by the user. In my example, I want that cell to reflect "PM(50%),TA,CR(25%)". Here are the logic rules:

1. If the Role is blank, don't show the Role.
2. If the % is zero but the Role is defined, don't show the role.
3. If the % is between 0 and 100%, show the percentage in brackets after the Role. (i.e. PM(50%)).
4. Separate the Role/% combinations with a comma as shown in my example, "PM(50%),TA,CR(25%)".

I was able to produce decent results but (a.) couldn't figure out the comma logic and (b.) had some HUGE formulas!

Thanks in advance! Shawn

<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th><th>I</th><th>J</th><th>K</th><th>L</th><th>M</th><th>N</th><th>O</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="font-weight: bold;font-style: italic;;">Role</td><td style="font-weight: bold;font-style: italic;;">Abbr</td><td style="text-align: right;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">Role 1</td><td style="text-align: center;border-left: 1px solid black;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">Role 2</td><td style="text-align: center;border-left: 1px solid black;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">Role 3</td><td style="text-align: center;border-left: 1px solid black;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">Role 4</td><td style="text-align: center;border-left: 1px solid black;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">Role 5</td><td style="text-align: center;border-left: 1px solid black;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">Role 6</td><td style="text-align: center;border-left: 1px solid black;;"></td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Project Manager</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">PM</td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">PM</td><td style="text-align: center;border-left: 1px solid black;;">50%</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">BA</td><td style="text-align: center;border-left: 1px solid black;;">0%</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">TA</td><td style="text-align: center;border-left: 1px solid black;;">100%</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;"></td><td style="text-align: center;border-left: 1px solid black;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">CR</td><td style="text-align: center;border-left: 1px solid black;;">25%</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;"></td><td style="text-align: center;border-left: 1px solid black;;"></td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">Business Systems Analyst</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">BA</td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">Technical Architect</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">TA</td><td style="text-align: right;border-left: 1px solid black;;"></td><td style=";">Summary:</td><td style="background-color: #DCE6F1;;"></td><td style="text-align: center;background-color: #DCE6F1;;"></td><td style="text-align: center;background-color: #DCE6F1;;"></td><td style="text-align: center;background-color: #DCE6F1;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">Application Developer</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">AD</td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">Information Architect</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">IA</td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";">Designer (Creative)</td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;">CR</td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;"></td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;"></td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style="text-align: right;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;"></td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style="text-align: right;;"></td><td style="text-align: center;border-right: 1px solid black;background-color: #F2F2F2;;"></td><td style="text-align: right;border-left: 1px solid black;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td><td style="text-align: center;;"></td></tr></tbody></table><p style="width:2.4em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">UTIL</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">O5</th><td style="text-align:left">=IF(<font color="Blue">N2="","",N2</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">O6</th><td style="text-align:left">=IF(<font color="Blue">O2="","",IF(<font color="Red">O2=1,"",TEXT(<font color="Green">O2,"(0%)"</font>)</font>)</font>)</td></tr><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">O7</th><td style="text-align:left">=IF(<font color="Blue">OR(<font color="Red">O5="",O6=""</font>),"",O5&O6</font>)</td></tr></tbody></table></td></tr></table><br />
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Shouldn't it read: PM(50%),TA(100%),CR(25%) ?

You'd have to do a nice long formula, but do it in sections. Using "&" is easier than concatenate...

=IF(e2="","","PM(" & TEXT(e2,"(0%)") & ")") & ...
 
Upvote 0
No, if the Role is at 100%, we'll show only the Role abbreviation. TA at 100% = TA, not TA(100%).

The tricky part isn't coming up with the formulas to show the Role and %, its when to show or hide the comma, believe it or not!
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

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