Formula or Code to Add a Value AND Delete Line

kmsprague

New Member
Joined
Nov 14, 2022
Messages
27
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a report that gives all the data as one big list. To match it up with the invoice, I need to combine and delete some lines. Basically, the breakdown is like this:

PlanCode for Billing
Just Plan 1
1​
Just Plan 2
2​
Just Plan 3
3​
Plan 1 & 3
4​
Plan 2 & 3
5​

So If I have a person who has a combination (Plan 1 & 3 or Plan 2 & 3), I need the code to populate as 4 or 5 respectively, but delete the second line for that person.

Employee NumberLast NameFirst NamePlanCode for Billing
1234​
SmithBillPlan 1
1​
4281​
WilsonJoePlan 2
2​
5678​
MillerMaryPlan 1
4​
5678​
MillerMaryPlan 2Delete Line
7592​
SimpsonBarbPlan 2
5​
7592​
SimpsonBarbPlan 3Delete Line

I've tried multiple conditioning formatting options, but so far all I've been able to do is highlight them and then manually override the code for billing and manually delete the extra line. Does anyone know of a better way to attack this? It takes up a lot of time. I appreciate all your ideas on how to go about this! Thank you in advance for your help!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
This should serve, but it isn't great - I haven't gotten it down to one formula.

MrExcelPlayground18.xlsx
ABCDEFGH
1Employee NumberLast NameFirst NamePlanPlanCode
21234SmithBillPlan 1Plan 11
34281WilsonJoePlan 2Plan 22
45678MillerMaryPlan 1Plan 33
55678MillerMaryPlan 2Plan 1,Plan 24
67592SimpsonBarbPlan 2Plan 2,Plan 35
77592SimpsonBarbPlan 3
8
9Employee NumberLast NameFirst NamePlansCode
101234SmithBillPlan 11
114281WilsonJoePlan 22
125678MillerMaryPlan 1,Plan 24
137592SimpsonBarbPlan 2,Plan 35
Sheet13
Cell Formulas
RangeFormula
A10:C13A10=UNIQUE(A2:C7)
D10:D13D10=TEXTJOIN(",",TRUE,FILTER($D$2:$D$7,$A$2:$A$7=A10))
E10:E13E10=XLOOKUP(D10,$G$2:$G$6,$H$2:$H$6,"",0)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,313
Members
449,153
Latest member
JazzSingerNL

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