Add Offset to Filter in VBA

GeeWhiz7

Board Regular
Joined
Nov 22, 2021
Messages
214
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi

Hopefully a fairly simple issue to resolve...
I have worksheets that track some processes automatically getting information as actions occur by date. I am trying to modify the vba and am struggling to find a way to put an OFFSET in my formula.

In the simplified example below there are columns for date, action, requsted, started.

To get the "requested" dates, I use the following formula in vba which works just fine.
It returns the position # of the search of the Action column (B) when finding "Request" to the FILTER function for dates (A).

VBA Code:
=FILTER($A$2:$A$20,ISNUMBER(SEARCH("Request",$B$2:$B$20)))

For reasons too long to explain, but in essence to keep inline with the existing coding. I would like to use the same method (ie stay in VBA and still use FILTER/SEARCH, but add OFFSET? unless not possible to get the date just one row after the "Request". Sometimes the input data isn't always perfect so I have found that sticking with the FILTER/SEARCH method always works to get the proper Requested date.

Goal: Use modified version of formula above to return the date offset by 1 row from when a request is make. This will indicate the production run start date which is always one business day from when requested.

Example below, hopefully it makes sense what I'm looking for.

Thanks!

Book2
ABCDEFGH
1DateActionRequestedStartedRequestedStarted
28/3/2022InProd8/9/2022?8/9/20228/10/2022
38/4/2022InProd8/18/2022?8/18/20228/19/2022
48/5/2022InProd8/26/2022?8/26/20228/29/2022
58/8/2022Complete
68/9/2022RequestDesired result using vba/filter/search/offset?
78/10/2022InProd
88/11/2022InProd
98/12/2022InProd
108/15/2022InProd
118/16/2022InProd
128/17/2022Complete
138/18/2022Request
148/19/2022InProd
158/22/2022InProd
168/23/2022InProd
178/24/2022InProd
188/25/2022Complete
198/26/2022Request
208/29/2022InProd
Sheet2
Cell Formulas
RangeFormula
D2:D4,G2:G4D2=FILTER($A$2:$A$20,ISNUMBER(SEARCH("Request",$B$2:$B$20)))
Dynamic array formulas.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
This works to get the next row, just needed some more thinking I guess.

E2 =
=FILTER(OFFSET($A$2:$A$20,1,0),ISNUMBER(SEARCH("Request",$B$2:$B$20)))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,814
Messages
6,181,124
Members
453,021
Latest member
Justyna P

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