What formula/function should I use?

Shmeetbag

Board Regular
Joined
Nov 30, 2004
Messages
88
What formula/function should I use?


I have tried Vlookup and IF functions but can’t seem to get this to work.
In column A1:A50 there will be a number imputed in random places. I need the sum of area B1:C50 between the numbers in column A returned in column D on the same row as the number in column A.

A1=3 B1=20 C1=5 D1=35
A2=””B2=10 C2=”” D2=””
A3=5 B3=””C3=10 D3=50
A4=”” B4=”” C4=30 D4=””
A5=”” B5=10 C5=”” D5=””
A6=”” B6=”” C6=”” D6=””
A7=8 B7=1 C7=””D7=1
A8=11 B8=12 C8=”” D8=12


3 is imputed in column A1 and returns 35 in D1 (20+10+5). 5 is imputed in A3 and returns 50 in D3 (10+30+10).

Thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
That won't work because the formula needs to sum the numbers in the range B1:C50. The order of the numbers in column A will have a different number of spaces in between them as well as different imputs in the range of B1:C50.
 
Upvote 0
Not the prettiest way perhaps...

in D1

=IF(A1,SUM(B1:INDEX(C1:C$100,IF(ISNA(MATCH(TRUE,INDEX(A2:A$100<>0,0),0)),ROWS(A2:A$100),MATCH(TRUE,INDEX(A2:A$100<>0,0),0)))),"")

copied down column

assumes you have up to 100 rows, if you have more then adjust ranges accordingly
 
Upvote 0
Following your logic in your first post, I don't follow how my formula will not suit. Maybe if you could post more info or 10-20 rows of example data with the HTML Maker..
 
Upvote 0
A slight problem

The formula works, but if I have a formula in column A, it does not work. When I type in a number it will work fine. For some reason this formula cannot read from column A when it has a formula in it. How could I get around that??

=IF(A1,SUM(B1:INDEX(C1:C$100,IF(ISNA(MATCH(TRUE,INDEX(A2:A$100<>0,0),0)),ROWS(A2:A$100),MATCH(TRUE,INDEX(A2:A$100<>0,0),0)))),"")

Thanks
 
Upvote 0
What would the formula be? what do you get in the cell if not a number?

if you have a formula which gives you either a number or "" perhaps

=IF(ISNUMBER(A1),SUM(B1:INDEX(C1:C$100,IF(ISNA(MATCH(TRUE,INDEX(A2:A$100<>0,0),0)),ROWS(A2:A$100),MATCH(TRUE,INDEX(A2:A$100<>0,0),0)))),"")
 
Upvote 0
If any formula is in the cell it does not work. The error is #value!. It does return a value only in the row with the input in column A, but the incorrect number.
 
Upvote 0
Having formulas in column A won't make any difference per se but it may affect how my proposed formula works, depending on what results those formula return, if they return text values you may get an error.

Did you try the revised formula I posted above?

What formula is in column A?
 
Upvote 0

Forum statistics

Threads
1,213,520
Messages
6,114,099
Members
448,548
Latest member
harryls

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