I’m using the sumif function, and instead of hardcoding what the range and sum_range cell ranges are, I want to look them up using something like match. Basically, the column that will be my sum_range has a column header that I could look up, so in pseudo code, what I want to be able to do is:
- Find the column header for the range I want to sum
- Once that column is found, select the entire column as the range
- Use this newly found range as either my
rangeorsum_rangefor thesumiffunction
Anyone know how to do this?
You may have a look at the following example and adapt it to your needs:
Match()selects the desired column (as given by cellF2)Index()then cuts this column from the given arraySum()does the sum – I used the sum function but you may take any function you like