Excel Formula syntax creation

I have expenses listed with a code that corresponds to a budget line item. How do I calculate the total sum of all entries that begin with the first number of the General ledger code it is assigned so I can sum up to the main code level. such as 1000 is utilities, i have codes for detailed costs with codes 1001 1002 1003 etc. I need them summed to the 1000 code level