I want to the daily number of hours performed by each department from a pivot table but because the types of hours and number of columns can change, I can't use the formula below. Is there a way to search by the name of the column "grand total" instead of using a fixed column, column 8 in my formula?
=INDEX($F$5:$M$12,MATCH($F$21,$F$5:$F$12,0),8)
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]base[/TD]
[TD]OT[/TD]
[TD]CB-OT[/TD]
[TD]Orient[/TD]
[TD]Training[/TD]
[TD]Inservice[/TD]
[TD]Grand Total[/TD]
[/TR]
[TR]
[TD]CT[/TD]
[TD]8[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]US[/TD]
[TD]16[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]MRI[/TD]
[TD]24[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]8[/TD]
[TD]32[/TD]
[/TR]
[TR]
[TD]NM[/TD]
[TD]8[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]10[/TD]
[/TR]
</tbody>[/TABLE]
=INDEX($F$5:$M$12,MATCH($F$21,$F$5:$F$12,0),8)
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]base[/TD]
[TD]OT[/TD]
[TD]CB-OT[/TD]
[TD]Orient[/TD]
[TD]Training[/TD]
[TD]Inservice[/TD]
[TD]Grand Total[/TD]
[/TR]
[TR]
[TD]CT[/TD]
[TD]8[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]US[/TD]
[TD]16[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]MRI[/TD]
[TD]24[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]8[/TD]
[TD]32[/TD]
[/TR]
[TR]
[TD]NM[/TD]
[TD]8[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]10[/TD]
[/TR]
</tbody>[/TABLE]