Try this, you just need to set the ranges:
=INDEX("Talbe",MATCH("foo","First Column",0),MATCH("idz04","First Row",0))
For example, if your table is in the range A1: D4, use:
=INDEX(A1:D4,MATCH("foo",A:A,0),MATCH("idz04",1:1,0))
You can also use named ranges
To get the first columns and rows, use this formula:
=INDEX(data,MATCH("foo",INDIRECT(CHAR(64+COLUMN(data))&":"&CHAR(64+COLUMN(data))),0),MATCH("idz04",INDIRECT(COLUMN(data)&":"&COLUMN(data)),0))
To do this, using a script, use this code:
function LOOKUPGRID(data, rowHeader, colHeader) { for (var i = 0; i<data.length;i++) { if (data[i][0] === rowHeader) { for (var j = 0; j<data[0].length;j++) { if (data[0][j] === colHeader) { return (data[i][j]); } } } } return (null) }
You can then invoke the formula on your sheet as follows:
=LOOKUPGRID(A1:D4,"foo","idz04")