Use an Excel filter to show only the rows that match a value or meet a condition. Rows that do not match the condition are hidden temporarily, and subsequent data analysis excludes them.
To filter to Female cases only, click the drop-down button alongside Sex, and then
select Female in the list of values to match
To filter to cases where the subject is older than 40, click the drop-down button
alongside Age, and then click Number Filters > Greater Than, and then enter 40 as the cut-off point: