I have a workbook with an Inventory worksheet and several other worksheets named as job ids (0001, 0002, etc). When the User enters new job details onto a form, the form will create a new worksheet and name it as the next sequential number. I'm trying to add a formula to the Inventory worksheet that will access the job worksheet with the same name as the job id listed in the corresponding row of where the formula is being entered. I figured I would try to enter the formula in Excel (without VBA) first, then try to convert it to VBA. I can't seem to get the formula right (it returns a #REF! error). Here's the formula I've been working with (found it while researching this issue)
This formula does work, but I don't want to add the formula manually every time a new job is created.
File details:
Excel Formula:
=COUNTIF(INDIRECT("'"&B3&"'!J12:J500"),$Y$2).
This formula does work, but I don't want to add the formula manually every time a new job is created.
Excel Formula:
=COUNTIF('0001'!J12:J500,$Y$2)
File details:
- Formula goes in column Y of the inventory worksheet
- Individual job ids are stored in column B of the inventory worksheet
- Data is formatted as #### so a value of 1 appears as 0001
- Job worksheets are named 0001, 0002, etc.
- The J12:J500 reference isn't ideal. I would like for it to run J12:J and the last row, but I figured I would add the last row bit when I converted the formula to VBA.