Find Text (multiple times) in column C - insert array formula - drag down - paste values

jwb1012

Board Regular
Joined
Oct 17, 2016
Messages
167
Hello, I am looking for a macro to search column C and insert an array formula one row below every occurrence of "Resource Description." Then, in column A of each row that a formula will be inserted, there is a number - which calculates how many rows to drag this array formula down. After the array formula is inserted, I would like to drag the formula down that many rows, and paste as values.

Key issue: the cell reference bolded/underlined in the code below needs to refer to 1 row above the cell it is being inserted into AND must be locked with $ as it is shown below. This formula / drag technique is extracting a unique list of Resource IDs from another worksheet, based on certain criteria). I am also having issues with the paste as values.

Appreciate any support you may be able to provide!


Example:

CELL C23= "Resource Description"

ENTERED INTO CELL C24:
Code:
{=IFERROR(INDEX('Staffing Plan'!$K$14:$K$1008, MATCH(0, IF($T20='Staffing Plan'!$Y$14:$Y$1008, COUNTIF([I][B][U]$C$23:$C23[/U][/B][/I], 'Staffing Plan'!$K$14:$K$1008), ""), 0)),"")}


CELL C28= "Resource Description"

ENTERED INTO CELL C29:
Code:
{=IFERROR(INDEX('Staffing Plan'!$K$14:$K$1008, MATCH(0, IF($T20='Staffing Plan'!$Y$14:$Y$1008, COUNTIF([I][B][U]$C$28:$C28[/U][/B][/I], 'Staffing Plan'!$K$14:$K$1008), ""), 0)),"")}


"Resource Description" will be found many times in column C and will not always be in the same rows.
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I'm not answering your question asked, but if we were to know more about getting the list of unique Resource IDs, It could be that the code could get that list and put it directly into this sheet quicker and more simply than worrying about the array formulas. Would it be worth investigating that?

If so, perhaps you could show us small amount of dummy data from that other worksheet and explain how each list of unique IDs would be obtained manually.

See Attachments for good ways to provide sample data that we can copy/paste to test with.
 
Last edited:
Upvote 0
1REPORT 2
LABOR HOURS BY RESOURCE
Resource DescriptionLabor CategoryJob TitleEIDHours
7Resource A X Y Z0
0END
January 1, 2017
MONTHLY LABOR HOURS SUMMARY BY TASK
Task Title:Task 1 1-1
Task Description:This is Task 1….. 1-1
Base1-1
Resource DescriptionJan-2018Feb-2018Mar-2018Apr-2018May-2018Jun-2018Jul-2018Aug-2018Sep-2018Oct-2018Nov-2018Dec-2018Grand Total1-1
3Resource A 47247247247247247247247247247247247256641-1
1-1
4724724724724724724724724724724724725,6641-1
Option 11-1
Resource DescriptionJan-2019Feb-2019Mar-2019Apr-2019May-2019Jun-2019Jul-2019Aug-2019Sep-2019Oct-2019Nov-2019Dec-2019Grand Total1-1
3Resource A 47247247247247247247247247247247247256641-1
1-1
4724724724724724724724724724724724725,6641-1

<tbody>
</tbody><colgroup><col><col><col><col span="2"><col span="13"><col><col></colgroup>
 
Upvote 0
I am open to any/all ideas...

In the table above, I need to extract 2 different unique lists (the second unique list is repeated multiple times). The first table is a summary of hours by resource for Project 1. On another worksheet called "Staffing Plan" in column K - we have the "Resource Description" column. In column W - we have the Project Number. So I need to extract the unique list of resources assigned to Project 1. Cell $A1 has the Project Number

Inserted into cell C24, C29, etc...
Code:
{=IFERROR(INDEX('Staffing Plan'!$K$14:$K$1008, MATCH(0, IF($A$1='Staffing Plan'!$W$14:$W$1008, COUNTIF($C$14:$C14, 'Staffing Plan'!$K$14:$K$1008), ""), 0)),"")


Then below the Project 1 table is a Project 1 - Task 1 table. So this unique list extracts the unique resources for Project 1 - Task 1. The "Project Number-Task Number" field is in column Y (instead of column W) of the staffing plan. Cell $T24 has the Project Number-Task Number

Code:
=IFERROR(INDEX('Staffing Plan'!$K$14:$K$1008, MATCH(0, IF($T24='Staffing Plan'!$Y$14:$Y$1008, COUNTIF($C$23:$C23, 'Staffing Plan'!$K$14:$K$1008), ""), 0)),"")
 
Last edited:
Upvote 0
The requirements and expected results are not clear to me from what has been posted.
 
Upvote 0
Okay, so at a more general level here is the scenario I am trying to sort through:

Worksheets:
  1. Staffing Plan - "resource" field in column K and "Project Number" field in column W
  2. Labor BOE 1 of X (ex: Labor BOE 1 of 2, Labor BOE 2 of 2) - a different code creates multiple copies of a template based on a user selection and numbers them sequentially - this is in cell A1 and is the "Project Number"

My spreadsheets creates copies of the template for each project, renames them "Labor BOE 1 of N) and numbers them sequentially in cell A1. I need to extract a unique list of resources from the "resource description" filed on the staffing plan (column K) IF the project number in column W matches the project number in cell A1.

I need to insert this unique list in column C every time there is a non blank cell in column A.

Does that make sense?
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

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