How to compare header value in excel?


Need to get header value and compare the same with other input value.
Example we have dates staring from 1-feb-2019 to 28-feb-2019 as header names and contains P and A as values in each columns. want to find total present count on 5th Feb 2019.


There are two possibilities for solution:-

a) If you are just interested in checking on today, how many days the person is present, then only COUNTIF () function is sufficient, as mentioned below:

=COUNTIF( $A$2:$AB$2, "P") ,

. . . . where $A$1:$AB$2 is the range of cells contain date-wise and P /A data.

b) If you are interested in knowing no. of days the person is present on any day, which is before today’s date, then in two steps you can indirectly refer the matching column for using COUNTIF().

This solution is as depicted in Excel Screenshot .

(Please note that Cell B9 and C11 both contain functions. B9 contains =HLOOKUP(A6,A1:T3,3,FALSE) and function in C11 is visible in formula bar as in above Excel screenshot)