How to apply a formula a certain number of times based on another cell

Grace1918

New Member
Joined
Feb 24, 2020
Messages
13
Office Version
  1. 365
Hey there,

I have two tables that contain all of our companies employees and am looking to count the number of times a certain position occurs in one table and put the adjacent name into a row in another column. I am currently using
VBA Code:
=IFERROR(INDEX($A:$A,SMALL(IF("Senior Project Director"=$B:$B,ROW($B:$B),""),ROW()-ROW(F2))),"")
and was hoping that someone would know of a way to have a macro drag the formula down the number of cells that certain position occurs.

I have been using Countif to count the positions but I don't know if that applies to VBA. We are always adding new employees to the list so that's why I was hoping it could be dynamic instead of having a long array.

Thanks in advance to anyone who has any ideas.
 
Ok, you cannot use indirect with dynamic named ranges.
Create a named range called Senior_Project_Director that refers to F3:F16 & use this in the Data validation
=OFFSET(INDIRECT(SUBSTITUTE($F2," ","_")),0,0, COUNTIF(INDIRECT(SUBSTITUTE($F2, " ","_")),"?*"),1)
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,214,984
Messages
6,122,601
Members
449,089
Latest member
Motoracer88

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