Need a formula to count the values for multiple values

edited 01/31/23 in Smartsheet Basics

In Source sheet i have two columns Department and Grade. In Target sheet, i need the count for the departments with grades in different column. However department names starting with similar word need to be retrieved the count in the same cell.

Source Sheet:

Target Sheet: I need these values in the Target Sheet:

As of now, the formula which i used, i'm getting count for just HAL, BHEL & CITI... not for others that starts with similar word(CITI Test,HAL22 etc).

I need to add Contain in the formula. Not sure where to add in the formula.

Formula Used: =COUNTIFS({Department}, $[.]@row, {Grade}, [..]$1)