Macro to insert value based on date plus value in other cells

Jibroni

New Member
Joined
Apr 7, 2022
Messages
25
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hello,

I need a macro or formula (or both??) to insert an end date into column E. Here is my spreadsheet:
Class IDCourse TitleCalendar Event NameScheduled Class Start DateScheduled Class End Date
06052022_GST_301301 Administration Fundamentals
6/5/2022​
6/7/2022​
08102022_CET_401401 Custom MPE Rules Using Regular Expression
8/10/2022​
08122022_CET_402402 Threat Detection with AI Engine
8/12/2022​
08112022_PT_302302 AI Engine Fundamentals
8/11/2022​
08122022_PT_305305 Analyst Fundamentals
8/12/2022​

The "Scheduled Class End Date" value is based on the last three numbers of the value in the first column, "Class ID." It's based on the following key:
301 = 3 days
401 = 2 days
402 = 1 day
302 = 1 day
305 = 1 day
...and so on for future values.

For example, the Scheduled Class End Date in the first row is 6/7/2022, because the Class ID has "301", which is equal to 3 days, and the class begins on 6/5/2022, as you can see in the "Scheduled Class Start Date" column.

I appreciate your help as always!
Jibs
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Make a lookup table for the added days then a formula like this?

22 04 16.xlsm
ADEFGHIJ
1Class IDScheduled Class Start DateScheduled Class End DateCodeDays
206052022_GST_30105-Jun-2207-Jun-223013
308102022_CET_40110-Aug-2211-Aug-224012
408122022_CET_40212-Aug-2212-Aug-224021
508112022_PT_30211-Aug-2211-Aug-223021
608122022_PT_30512-Aug-2212-Aug-223051
End Date
Cell Formulas
RangeFormula
E2:E6E2=D2+VLOOKUP(RIGHT(A2,3)+0,I$2:J$10,2,0)-1
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,184
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