If you are adding more columns, you need to match the range reference (in red) correctly according to your data for this formula to work correctly...
=IFERROR(INDEX($B$2:$M$45,MATCH($O$2,$A$2:$A$45,0),SMALL(IF($B$1:$M$1=$O4,COLUMN($B$1:$M$1)-COLUMN($B$1)+1),COLUMNS($P4:P4))),"")
where
B2:M45 is the total data range.
A2:A45 is the range containing Day nos.
O2 is the cell where you have input the day lookup value.
B1:M1 is the range containing vehicle types. you need to change it accordingly. Like if your last column is say AA1, the correct range will be B1:AA1
O4 is the cell where the formula has lookup value for the vehicle type.
In COLUMN($B$1:$M$1)-COLUMN($B$1), say if your last column is AA1, this will become COLUMN($B$1:$AA$1)-COLUMN($B$1)
In COLUMNS($P4:P4), P4 is the first cell where you put this formula, So if you have more columns and you want to place this formula in say AD4, this part will become COLUMNS($AD4:AD4).
Change all the ranges according to your actual data, and this formula will work.
Hope this helps.
Bookmarks