Match Function with Array as Lookup Value

RichardElk

New Member
Joined
Feb 7, 2014
Messages
8
Hi,

I have some data that looks like this:

(Sheet1)
Crew Day1

CR1 5
CR1 2
CR2 3
CR5 1

(Sheet2 Array)
CrwMkp B C D
CR1 1 3 1
CR2 2 1 1
CR3 5 0 0
CR4 6 2 3
CR5 0 1 0

What I am trying to do is to look through Sheet1 and for every non-zero instance in column called Day1 count the number of of a particular resource used. So for example if i was looking for the resource count for resource B on Day 1 i would look for a result of 4 (Two occurances of CR1 = 2 B's, 1 instance of CR2 = 2B's)

Here is an example of the formula i am using modified for the example above:


={Sum(If(Day1<>0,1,0)*Index({Sheet2Array},Match({Crew},{CrwMkp}),2))}

I think my issue is stems from using an array as a lookup_value in the match function but im not sure of a workaround for this.

Any help would be very much appreciated.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Maybe

Sheet2


[TABLE="class: grid"]
<TBODY>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]
CrwMkp​
[/TD]
[TD]
B​
[/TD]
[TD]
C​
[/TD]
[TD]
D​
[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]
CR1​
[/TD]
[TD]
1​
[/TD]
[TD]
3​
[/TD]
[TD]
1​
[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]
CR2​
[/TD]
[TD]
2​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]
CR3​
[/TD]
[TD]
5​
[/TD]
[TD]
0​
[/TD]
[TD]
0​
[/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]
CR4​
[/TD]
[TD]
6​
[/TD]
[TD]
2​
[/TD]
[TD]
3​
[/TD]
[/TR]
[TR]
[TD]
6
[/TD]
[TD]
CR5​
[/TD]
[TD]
0​
[/TD]
[TD]
1​
[/TD]
[TD]
0​
[/TD]
[/TR]
</TBODY>[/TABLE]



Sheet1

[TABLE="class: grid"]
<TBODY>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[TD]
E
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]
Crew​
[/TD]
[TD]
Day1​
[/TD]
[TD][/TD]
[TD]
Resource​
[/TD]
[TD]
Result​
[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]
CR1​
[/TD]
[TD]
5​
[/TD]
[TD][/TD]
[TD]
B​
[/TD]
[TD]
4​
[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]
CR1​
[/TD]
[TD]
2​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]
CR2​
[/TD]
[TD]
3​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]
CR5​
[/TD]
[TD]
1​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]


Array formula in E2
=SUM(SUMIF(Sheet2!$A$2:$A$6,IF($B$2:$B$5<>0,$A$2:$A$5),INDEX(Sheet2!$B$2:$D$6,0,MATCH(D2,Sheet2!$B$1:$D$1,0))))

confirmed with Ctrl+Shift+Enter, not just Enter

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,223,101
Messages
6,170,116
Members
452,302
Latest member
TaMere

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