Store column references in an Array if there is an approximate match

Bering

Board Regular
Joined
Aug 22, 2018
Messages
186
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I have a range with several columns (the number can vary) and 58 rows. The header is a named range ("Headers") in row2. In the headers, the string Total can appear several times as in Total x, Total Y, Total Z and so on.
Rows from 6 to 58 contain numbers.
I would like to add a formula to the right that adds up all the figures in the same row for all the columns which contain the string "Total" in the header.

So, say the the current range is A2 to U58: if there are three column headers containing the string Total (column N, Q and R) , the macro should add in cell V6 the formula N6+Q6+R6 that would then be filled down to row 58.

I guess this could be achived with an Array. Would anyone please point me to the right direction? I can manage to achieve most of this but I find Arrays and the approximate matches tricky.

Many thanks in advance
 

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.
How about
=SUMIFS(A3:U3,Headers,"Total*")
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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