Index and Match Question

dturgel

Board Regular
Joined
Aug 6, 2015
Messages
58
Hi,

I have three columns that I am trying to pull data from via index and match and the current formula I have is missing certain data points - any ideas?

Column 1 (account numbers) Column 2 (Revenue) Column 3 (counts accounts left 5) Column 4 (sums revenue by account)
10001-11 $10,000 1 (Trying to get $60,000 here)
10001-21 $20,000 0 (Trying to get $0 here)
10001-31 $30,000 0 (Trying to get $0 here)

We have accounts that are linked by the first part of the value in column 1. Column 2 shows the value for each part of the account. Column 3 refers back to column 1 and is just set up to count the "10001" one time so we avoid counting the same account more than once (that formula is working fine: =IF(LEFT(A2,5)=LEFT(A3,5),0,1).

It's the next column that I can't figure out. So far what I've got is the following: =IF(C2=0,0,SUM(B2:INDEX(B:B,MATCH(TRUE,INDEX(C:C=1,0),0))))

I tried inserting a Left function but that didn't work. I'm lost - any suggestions?

Daniel
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi Daniel

Maybe...

D2
=IF(C2=0,0,SUMPRODUCT(--(LEFT($A$2:$A$100,5)=LEFT(A2,5)),$B$2:$B$100))
copy down

Hope this helps

M.
 
Upvote 0
Would SUMIFS not work? =sumifs(B:B,C2,1,A:A,left(A2,5)&"*")
 
Upvote 0
if you change your column C to give you the 10001 like this =IF(LEFT(A2,5)=LEFT(A1,5),0,LEFT(A2,5))

then this will work.
=IF(C2=0,0,SUMIF(A:A,C2&"*",B:B))
 
Upvote 0

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

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