I need a Formula to Autofill the date based on the Date, Specific Value, and then no of days

waseem0888

New Member
Joined
Aug 18, 2021
Messages
8
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
Platform
  1. Windows
I need the formula to fill out the date in (column C ) based on the date in (Column A) specific value in (Column B) and no of days to be fixed in the formula based on the value in Column B date from (ColumnA )and then fill the date in Column C

Example:

Column A (Issue Date) Column B(Category) Column C (Clouse Date)

1- Whenever (column B) category "CAR" is selected, Closeout Date (Column C) shall count 7 working days (Without Sat & Sunday) from the "Issued date" (Column A) and fill the date in (Column C)

2- Whenever (column B) category "AoA" is selected, Closeout Date (Column C) shall count 30 working days (Without Sat & Sunday) from the "Issued date" (Column A) and fill the date in (Column C)

3- Whenever (column B) category "External NC " is selected, Closeout Date (Column C) shall count 90 working days (Without Sat & Sunday) from the "Issued date" (Column A) and fill the date in (Column C)

4- Whenever (column B) category "External AoA " is selected, Closeout Date (Column C) shall count 150 working days (Without Sat & Sunday) from the "Issued date" (Column A) and fill the date in (Column C)

Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Like this?

BTW, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

24 03 22.xlsm
ABC
1Issue DateCategoryCloseout Date
2Monday, 1 January 2024CARWednesday, 10 January 2024
3Tuesday, 2 January 2024AoATuesday, 13 February 2024
4Wednesday, 3 January 2024External NCWednesday, 8 May 2024
5Thursday, 4 January 2024External AoAThursday, 1 August 2024
6Friday, 5 January 2024CARTuesday, 16 January 2024
7Saturday, 6 January 2024CARTuesday, 16 January 2024
8Sunday, 7 January 2024CARTuesday, 16 January 2024
9Monday, 8 January 2024Other 
10Tuesday, 9 January 2024External NCTuesday, 14 May 2024
waseem0888
Cell Formulas
RangeFormula
C2:C10C2=IFNA(WORKDAY(A2,CHOOSE(MATCH(B2,{"CAR","AoA","External NC","External AoA"},0),7,30,90,150)),"")
 
Upvote 0
I tend to do that sort of thing using a lookup table. Its easier to understand and easier to maintain.
If you make the lookup table an actual table it will autoexpand so that you don't have to change the formula.

20240322 Working Days by Category waseem0888.xlsx
ABCDEF
1Issue DateCategoryCloseOut DateLookup Table
222/03/2024CAR2/04/2024
322/03/2024AoA3/05/2024CategoryWorking Days
422/03/2024External NC26/07/2024CAR7
522/03/2024External AoA18/10/2024AoA30
6External NC90
7External AoA150
Data
Cell Formulas
RangeFormula
C2:C5C2=WORKDAY(A2,VLOOKUP(B2,$E$4:$F$7,2,FALSE))
 
Upvote 0
Thank you so much for the formula.


In the same way, I need to do one more thing what if I want to include weekends as well?

let's say in the category CAR is selected then it should count 30 days simply.

For Example:

Column A (Issue Date) Column B(Category) Column C (Clouse Date)
07-April-2024 CAR 07-May-2024

I have tried but have had no luck appreciate your help

Thanks
 
Upvote 0
How is the formula going to decide whether you want working days or just days ?
Also your example will give the same result whether you use 30 days or 1 month because Apr is a 30 day month. Please confirm you want 30 days.
 
Upvote 0
I want to count just days.

As in your example: 22/03/2024 for AoA and the closeout date is 3/5/2024 so it counts as 30 working days where I need to change in formula to count the total no of days like it should be 22/04/2024 it should count simply 30 days.

and the same way for other categories 7,90 and 150 days (not only working days)
 
Last edited:
Upvote 0
Your 2nd example demonstrates exactly what I was trying to clarify. I think you will find that 22/03 to 22/04 is 31 days.

Also I don't know which formula you ended up using so below are both altered for the days instead of working days:
1) @Peter_SSs's
Excel Formula:
=IFNA(A2+CHOOSE(MATCH(B2,{"CAR","AoA","External NC","External AoA"},0),7,30,90,150),"")

2) Mine using a lookup table (I added the IFNA that Peter has in his)
Excel Formula:
=IFNA(A2+VLOOKUP(B2,$E$4:$F$7,2,FALSE),"")
 
Upvote 0

Forum statistics

Threads
1,223,838
Messages
6,174,942
Members
452,593
Latest member
Jason5710

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