Index match conditional

afrobea_r

Board Regular
Joined
Aug 16, 2015
Messages
76
Dear Excel Community,

Currently I have a parameters table that looks like this.

TypeABAABAABAABAABAABA
Dispatch5010501050105010502102
Days312831303130313130313031
MonthsJan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18

<colgroup><col width="64" span="13" style="width:48pt"> </colgroup><tbody>
</tbody>

How do I utilize index match function to return the dispatch values based on their types onto another table in another sheet that looks like this

Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
A
AB

<colgroup><col width="64" span="13" style="width:48pt"> </colgroup><tbody>
</tbody>

At the moment, the formula I have just gives me the same values as the first table under the dispatch row regardless if it is A or AB?

Thank you all in advance!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Is this what you mean? If not, please give the expected results for your sample data and explain why they are the results.

Formula in B8 is copied across and down.

Excel Workbook
ABCDEFGHIJKLM
1TypeABAABAABAABAABAABA
2Dispatch5010501050105010502102
3Days312831303130313130313031
4MonthsJan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
5
6
7Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
8A 1010101022
9AB505050505010
Dispatch Values
 
Upvote 0
EDIT: Peter has already provided a solution

Maybe something like this (adjust the ranges as needed)


A
B
C
D
E
F
G
H
I
J
K
L
M
1
Type​
AB​
A​
AB​
A​
AB​
A​
AB​
A​
AB​
A​
AB​
A​
2
Dispatch​
50​
10​
50​
10​
50​
10​
50​
10​
50​
2​
10​
2​
3
Days​
31​
28​
31​
30​
31​
30​
31​
31​
30​
31​
30​
31​
4
Months​
Jan-18​
Feb-18​
Mar-18​
Apr-18​
May-18​
Jun-18​
Jul-18​
Aug-18​
Sep-18​
Oct-18​
Nov-18​
Dec-18​
5
6
7
8
Jan-18​
Feb-18​
Mar-18​
Apr-18​
May-18​
Jun-18​
Jul-18​
Aug-18​
Sep-18​
Oct-18​
Nov-18​
Dec-18​
9
A​
10​
10​
10​
10​
2​
2​
10
AB​
50​
50​
50​
50​
50​
10​

<tbody>
</tbody>


Formula in B9 copied across and down
=IF(COUNTIFS($B$1:$M$1,$A9,$B$4:$M$4,B$8),INDEX($B$2:$M$2,MATCH(B$8,$B$4:$M$4,0)),"")

M.
 
Last edited:
Upvote 0
Hi,

Why not just use SUMIFS:


Book1
ABCDEFGHIJKLM
1TypeABAABAABAABAABAABA
2Dispatch5010501050105010502102
3Days312831303130313130313031
4MonthsJan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
5
6
7Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
8A0100100100100202
9AB500500500500500100
10
11
12Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
13A 1010101022
14AB505050505010
Sheet17
Cell Formulas
RangeFormula
B8=SUMIFS($B$2:$M$2,$B$1:$M$1,$A8,$B$4:$M$4,B$7)
B13=IF(SUMIFS($B$2:$M$2,$B$1:$M$1,$A13,$B$4:$M$4,B$7)=0,"",SUMIFS($B$2:$M$2,$B$1:$M$1,$A13,$B$4:$M$4,B$7))


Formula copied down and across.
 
Upvote 0
There are many alternatives ..

Excel Workbook
ABCDEFGHIJKLM
1TypeABAABAABAABAABAABA
2Dispatch5010501050105010502102
3Days312831303130313130313031
4MonthsJan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
5
6
7Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
8A 1010101022
9AB505050505010
Dispatch Values (2)
 
Upvote 0
Thank you Sir! This worked like magic!


Is this what you mean? If not, please give the expected results for your sample data and explain why they are the results.

Formula in B8 is copied across and down.

Dispatch Values

ABCDEFGHIJKLM
1TypeABAABAABAABAABAABA
2Dispatch5010501050105010502102
3Days312831303130313130313031
4MonthsJan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
5
6
7 Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
8A 10 10 10 10 2 2
9AB50 50 50 50 50 10

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:70px;"><col style="width:57px;"><col style="width:59px;"><col style="width:59px;"><col style="width:57px;"><col style="width:62px;"><col style="width:57px;"><col style="width:53px;"><col style="width:60px;"><col style="width:60px;"><col style="width:58px;"><col style="width:58px;"><col style="width:60px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
B8=IF(INDEX($B$1:$M$1,MATCH(B$7,$B$4:$M$4,0))=$A8,INDEX($B$2:$M$2,MATCH(B$7,$B$4:$M$4,0)),"")

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Thank you Sir for the additional workarounds!



EDIT: Peter has already provided a solution

Maybe something like this (adjust the ranges as needed)


A
B
C
D
E
F
G
H
I
J
K
L
M
1
Type​
AB​
A​
AB​
A​
AB​
A​
AB​
A​
AB​
A​
AB​
A​
2
Dispatch​
50​
10​
50​
10​
50​
10​
50​
10​
50​
2​
10​
2​
3
Days​
31​
28​
31​
30​
31​
30​
31​
31​
30​
31​
30​
31​
4
Months​
Jan-18​
Feb-18​
Mar-18​
Apr-18​
May-18​
Jun-18​
Jul-18​
Aug-18​
Sep-18​
Oct-18​
Nov-18​
Dec-18​
5
6
7
8
Jan-18​
Feb-18​
Mar-18​
Apr-18​
May-18​
Jun-18​
Jul-18​
Aug-18​
Sep-18​
Oct-18​
Nov-18​
Dec-18​
9
A​
10​
10​
10​
10​
2​
2​
10
AB​
50​
50​
50​
50​
50​
10​

<tbody>
</tbody>


Formula in B9 copied across and down
=IF(COUNTIFS($B$1:$M$1,$A9,$B$4:$M$4,B$8),INDEX($B$2:$M$2,MATCH(B$8,$B$4:$M$4,0)),"")

M.
 
Upvote 0
Thank you Sir for this as well!

Hi,

Why not just use SUMIFS:

ABCDEFGHIJKLM
1TypeABAABAABAABAABAABA
2Dispatch5010501050105010502102
3Days312831303130313130313031
4MonthsJan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
5
6
7Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
8A0100100100100202
9AB500500500500500100
10
11
12Jan-18Feb-18Mar-18Apr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18
13A1010101022
14AB505050505010

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet17

Worksheet Formulas
CellFormula
B8=SUMIFS($B$2:$M$2,$B$1:$M$1,$A8,$B$4:$M$4,B$7)
B13=IF(SUMIFS($B$2:$M$2,$B$1:$M$1,$A13,$B$4:$M$4,B$7)=0,"",SUMIFS($B$2:$M$2,$B$1:$M$1,$A13,$B$4:$M$4,B$7))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Formula copied down and across.
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,693
Members
449,117
Latest member
Aaagu

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