Bulk/Quick Updates of Analysis Codes

Hello! We are a nonprofit and recently migrated from Pastel to Business Cloud Accounting at the beginning of 2021. At the time, we didn't know much about analysis codes and hadn't set them up. Because of our different departments, we desperately need to be able to report on each departments income and expenses separately. In Pastel, the only way we could accomplish this was through separate accounts, with each one named with the category followed by a dash and the department abbreviation (ex: Materials-ABC, Materials-XYZ, etc.), creating tons of accounts we still use. Unfortunately this isn't very helpful now, as we can't filter and report based on account names. We've been told analysis codes are now our best bet.

However, to apply these, that means we need to go back through every transaction this year and mark them with the proper analysis code. This could be an insanely long process, so I'm looking for any creative solution to accomplishing this more quickly. Does anyone have any ideas for where we might be able to get closest to the ability to run through a list and quickly add the codes?

Thanks in advance for any advice!