Excel Formula or VBA to return the corresponding values based on several criteria

woah

New Member
Joined
May 10, 2023
Messages
24
Office Version
  1. 2016
Platform
  1. Windows
I am using Excel 2016. I got a table. I want to return the corresponding date of cells that contains number (purple in colour). However, I do not need to return the date every time. It is based on the value in the column of "No of weeks". So if the no. of week is 1, return the corresponding date every consecutive cells with number. If the no. of weeks is 2, return the corresponding date every 2 consecutive cells with number. If the no. of weeks is 4, if only 3 cells with number, still return the corresponding date of the first cell. I want it to be able to return the date as shown in the sample excel.

If possible, I want to use formula to do so. If not, VBA is fine as well.
Please help me. Thank you all.

Sample.jpg
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

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