Addition based on the column heading

snjpverma

Well-known Member
Joined
Oct 2, 2008
Messages
1,584
Office Version
  1. 365
Platform
  1. Windows
Excel Workbook
ABCDEFGHI
1BaseBaseBase
2837051735168849282
3678084836377508056
Sheet1



In the above data, A1, E1 and G1 is updated as "Base". Cell G1 is the left most column among them. Please suggest a formula to get the sum of the values in the row 2 and 3 from the left most column with text "Base". in the above case my return value will be +84+50 i.e. G2+G3 = 134..

I am not good at excel. So, please help
 
I used this {1,2,6,7,9} in the below formula to sum the value in those rows.
=SUM(N(OFFSET(INDEX(A1:I1,0,MATCH(2,INDEX(1/(A1:I1="Base"),0))),{1,2,6,7,9},0)))

I would like to know if there is a way to sum a range using this? For example. Instead of rows 1,2,6,7,9 how can I put rows 2 to 8 and 10. I used {2:8, 10} in the above formula but in vain. Please advise

Try,

=SUM(N(OFFSET(INDEX(A1:I1,0,MATCH(2,INDEX(1/(A1:I1="Base"),0))),{1,2,3,4,5,6,7,9},0)))

Regards
Bosco
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Works great. But I don't know what is the role of N there? I tried using evaluate formula but still could not get it. Please explain me the role of N in the above formula. Thanks in advance
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,779
Members
449,049
Latest member
greyangel23

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