Okay.. this is kind of a tongue twister but... I need to replace the text "$D$26" within column D with an absolute reference to the cell address of *the cell 1 row above* the cell containing this formula. The formula will appear every 10 rows. I have the code below, that seems to work but... I cant figure out how to do a this "dynamic" absolute reference.
Is this possible?
For example,
Cell D27 BEFORE Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L26='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$26:$D26, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")
Cell D37 BEFORE Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L36='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$26:$D36, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")
---
Cell D27 AFTER Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L26='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$26:$D26, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")
Cell D37 AFTER Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L26='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$36:$D36, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")
Is this possible?
Code:
Sub FindAndReplace()
Dim Findtext As String
Dim Replacetext As String
Findtext = "$D$26:"
Replacetext = " [I][U][B]< insert "dynamic" absolute reference to the cell 1 row above >[/B][/U][/I] "
Columns("D").Replace what:=Findtext, replacement:=Replacetext, lookat:=xlPart, MatchCase:=FalseEnd Sub
For example,
Cell D27 BEFORE Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L26='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$26:$D26, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")
Cell D37 BEFORE Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L36='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$26:$D36, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")
---
Cell D27 AFTER Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L26='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$26:$D26, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")
Cell D37 AFTER Code:
=IFERROR(INDEX('Staffing Plan'!$J$8:$J$1002, MATCH(0, IF($L26='Staffing Plan'!$W$8:$W$1002, COUNTIF($D$36:$D36, 'Staffing Plan'!$J$8:$J$1002), ""), 0)),"")