Finding Letter through Formula

Pestomania

Active Member
Joined
May 30, 2018
Messages
332
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a table that I need to sum up the years. I have done it simply through formulas like you see but that is not going to last much longer as I now have 50 rows and 20 years which makes for a lot of formulas.

Is there a way to automate this process? 2020 starts in column T.

Preference would be something that would be like:

Excel Formula:
=SUM(H2&":"&INDIRECT(SUBSTITUTE(ADDRESS(1, COLUMN((H2))+11, 4), 1, "")&"2"))

Unfortunately, this doesn't return what I hoped for in columns AQ:AS. I would even go as far as just "identify what row the formula is in" so that there is no concern with that as well.

Book2
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARAS
1Jan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24Feb-24Mar-24Apr-24May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25Feb-25Mar-25Apr-25May-25Jun-25Jul-25Aug-25Sep-25Oct-25Nov-25Dec-252023 Total2024 Total2025 Total2023 Total2024 Total2025 Total
2Program 11311322413304926238203361042101341371414387204153034422543441062582043070.5555560.4604171.358333
3Program 261744263724352022918262014384020381740141926331835411333353240134636202843193620.2638890.7104171.858333
Sheet1
Cell Formulas
RangeFormula
AM2:AM3AM2=SUM(B2:M2)
AN2:AN3AN2=SUM(N2:Y2)
AO2:AO3AO2=SUM(Z2:AK2)
AQ2:AS3AQ2=SUM(B2&":"&INDIRECT(SUBSTITUTE(ADDRESS(1, COLUMN((B2))+11, 4), 1, "")&"2"))
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Column T says Jul-24, which looks like it should be 2024. How is this 2020?

I don't know why you are using INDIRECT anyway. Why is that the preference?

Make your column headers in AQ2:AS2 just the Year so that it can be referenced by the formula. Format these cells as 0 "Totals"
=SUMPRODUCT($B2:$AK2,--(YEAR($B$1:$AK$1)=AQ$1))

Copy across and down.

year totals.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARAS
1Jan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24Feb-24Mar-24Apr-24May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25Feb-25Mar-25Apr-25May-25Jun-25Jul-25Aug-25Sep-25Oct-25Nov-25Dec-252023 Total2024 Total2025 Total2023 Totals2024 Totals2025 Totals
2Program 1131132241330492623820336104210134137141438720415303442254344106258204307258204307
3Program 26174426372435202291826201438402038174014192633183541133335324013463620284319362284319362
Sheet1
Cell Formulas
RangeFormula
AM2:AM3AM2=SUM(B2:M2)
AN2:AN3AN2=SUM(N2:Y2)
AO2:AO3AO2=SUM(Z2:AK2)
AQ2:AQ3,AR3:AS3AQ2=SUMPRODUCT($B2:$AK2,--(YEAR($B$1:$AK$1)=AQ$1))
AR2:AS2AR2=SUMPRODUCT($B2:$AK2,--(YEAR($B1:$AK1)=AR$1))
 
Upvote 0
Solution
Column T says Jul-24, which looks like it should be 2024. How is this 2020?

I don't know why you are using INDIRECT anyway. Why is that the preference?

Make your column headers in AQ2:AS2 just the Year so that it can be referenced by the formula. Format these cells as 0 "Totals"
=SUMPRODUCT($B2:$AK2,--(YEAR($B$1:$AK$1)=AQ$1))

Copy across and down.

year totals.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARAS
1Jan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24Feb-24Mar-24Apr-24May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25Feb-25Mar-25Apr-25May-25Jun-25Jul-25Aug-25Sep-25Oct-25Nov-25Dec-252023 Total2024 Total2025 Total2023 Totals2024 Totals2025 Totals
2Program 1131132241330492623820336104210134137141438720415303442254344106258204307258204307
3Program 26174426372435202291826201438402038174014192633183541133335324013463620284319362284319362
Sheet1
Cell Formulas
RangeFormula
AM2:AM3AM2=SUM(B2:M2)
AN2:AN3AN2=SUM(N2:Y2)
AO2:AO3AO2=SUM(Z2:AK2)
AQ2:AQ3,AR3:AS3AQ2=SUMPRODUCT($B2:$AK2,--(YEAR($B$1:$AK$1)=AQ$1))
AR2:AS2AR2=SUMPRODUCT($B2:$AK2,--(YEAR($B1:$AK1)=AR$1))


This worked amazingly! I had used the indirect for another formula and thought it was the best one to use, it apparently wasn't. I also didn't clarify correctly on the 2020, but this formula worked perfectly. Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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