VBA: Grouping Characters by 4 Characters and Formatting Cell That Reaches Limit

mykulpasskwa

Board Regular
Joined
Mar 20, 2018
Messages
66
The title may not be on-the-nose, and before I get started the bottom line is I need Excel to indicate to me in the payments when a client reached a cap for each year across different years. If there's a better way than what I have below, I'm open to any creative ideas, this was just the best idea I've had.

I'm basically trying find the cells with the same year based on a term code, summing the payments next to those cells, and then highlight the payment where they reached the cap for that year. I know bits and pieces of how it should go, but I can't figure out the whole song.

I have a column (Lets say col A) with varying terms within a year, and each year has a different limits on what a client needs to pay. Once they reach that limit then the funding comes from a different source. Each term code is the four digit year and the single digit term, so this year would be 20201, 20202, 20203, etc.

The adjacent column (col B) has the payments, and they only need to pay up to a certain point but it's different every year. So in 2019 the cap was $350, but in 2020 the cap is $650. I'm trying to figure out how to group those term codes based on the year, then sum that group, and then format the cell where they reached the cap.

Attached is a thumbnail which I'd like the end product to look like that I manually put together. So in 2019 the cap was $350, but they didn't pay that until 20193 so that is what is highlighted in yellow. Comparatively, the cap in 2020 is $650, but they didn't reach cap until 20204 so that's what's highlighted. The main point being that both payments are highlighted because they are from different years and the user didn't have to intervene other than inputting the payments.

1589393941410.png


I've been struggling on this for about 6 months. Some days it seems like I'm over-complicating this and other days it feels like it's just not possible. Any help that can be provided is truly, truly appreciated and will actually allow me to complete the rest of this project. Please let me know if anything needs to be clarified or you need more information. Thank you!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
If the entries in column A are text. the sum of payments in 2020 would be =SUMIF(A1:A100, "2020*", B1:B100)

If they are numbers =SUMIFS(B1:B100, A1:A100, "<2021", A1:A100, ">=2020")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top