Conditional INDEX-MATCH statement involving three data categories

DaRook1e

New Member
Joined
May 17, 2017
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Dear community,

I've been struggling a lot lately with the following task but so far in vain... I am not a regular in excel forums bt in this case I don't have any alternative. Basically, I am trying to figure out how to distinguish between repeating categories in groups 2 and 3 while groups 1 remains unique. My result should then either multiply the values of matched categories or return the single values from the unmatched categories. I have been trying really hard with combinations using INDEX, MATCH, IF and COUNTIF statements but without success. Please read below and refer to the attached screenshot for more clarity.

IF:
Items in group 1 differ from each other (unique values) but items in group 2 and 3 are the same. In this case multiply the values in column "D" of the matching rows with each other.

ELSE:
return the row from table "before"

Result should match the one in column "J".

Your help will be very much appreciated! Thank you in advance.

Best
Evgeni
 

Attachments

  • MatchMultipleGroups.PNG
    MatchMultipleGroups.PNG
    41.8 KB · Views: 14

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Why are the values in rows 13 & 14 multiplied together when there is a Group 2 mismatch? A similar question for rows 23, 24, and 25 where there are mismatches in Groups 2 & 3.

What version of Excel are you using?

If you have Excel 365, is this what you want?
MrExcel_20220505B.xlsx
ABCDEFG
1
2Group 1Group 2Group 3ValuesPost #1 ResultMy Result
3applesmallgreen555
4applesmallred101010
5applebigyellow15225225
6applebigyellow15225225
7applemiddleyellow151515
8applesmallyellow151515
9breadbigrye202020
10breadmiddlerye20400400
11breadmiddlerye20400400
12breadsmallspelt25625625
13breadbigspelt2562525
14breadmiddlespelt2562525
15breadsmallspelt25625625
16breadsmallwheat30900900
17breadsmallwheat30900900
18breadbigwheat303030
19breadmiddlewheat303030
20pearbigbrown353535
21pearmiddlebrown354287542875
22pearmiddlebrown354287542875
23pearsmallgreen5428755
24pearsmallyellow154287515
25pearmiddleyellow154287515
26pearmiddlebrown354287542875
Sheet8
Cell Formulas
RangeFormula
G3:G26G3=PRODUCT(FILTER($D$3:$D$26,($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)))
 
Last edited:
Upvote 0
Or a non-365 version:
MrExcel_20220505B.xlsx
ABCDEFGH
2Group 1Group 2Group 3ValuesPost #1 ResultMy ResultNon Excel 365
3applesmallgreen5555
4applesmallred10101010
5applebigyellow15225225225
6applebigyellow15225225225
7applemiddleyellow15151515
8applesmallyellow15151515
9breadbigrye20202020
10breadmiddlerye20400400400
11breadmiddlerye20400400400
12breadsmallspelt25625625625
13breadbigspelt256252525
14breadmiddlespelt256252525
15breadsmallspelt25625625625
16breadsmallwheat30900900900
17breadsmallwheat30900900900
18breadbigwheat30303030
19breadmiddlewheat30303030
20pearbigbrown35353535
21pearmiddlebrown35428754287542875
22pearmiddlebrown35428754287542875
23pearsmallgreen54287555
24pearsmallyellow15428751515
25pearmiddleyellow15428751515
26pearmiddlebrown35428754287542875
Sheet8
Cell Formulas
RangeFormula
G3:G26G3=PRODUCT(FILTER($D$3:$D$26,($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)))
H3:H26H3=PRODUCT(IFERROR(($D$3:$D$26)/(($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)),""))
 
Upvote 0
Or a non-365 version:
MrExcel_20220505B.xlsx
ABCDEFGH
2Group 1Group 2Group 3ValuesPost #1 ResultMy ResultNon Excel 365
3applesmallgreen5555
4applesmallred10101010
5applebigyellow15225225225
6applebigyellow15225225225
7applemiddleyellow15151515
8applesmallyellow15151515
9breadbigrye20202020
10breadmiddlerye20400400400
11breadmiddlerye20400400400
12breadsmallspelt25625625625
13breadbigspelt256252525
14breadmiddlespelt256252525
15breadsmallspelt25625625625
16breadsmallwheat30900900900
17breadsmallwheat30900900900
18breadbigwheat30303030
19breadmiddlewheat30303030
20pearbigbrown35353535
21pearmiddlebrown35428754287542875
22pearmiddlebrown35428754287542875
23pearsmallgreen54287555
24pearsmallyellow15428751515
25pearmiddleyellow15428751515
26pearmiddlebrown35428754287542875
Sheet8
Cell Formulas
RangeFormula
G3:G26G3=PRODUCT(FILTER($D$3:$D$26,($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)))
H3:H26H3=PRODUCT(IFERROR(($D$3:$D$26)/(($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)),""))

Hey KRice,

much appreciated, works perfectly! :) Apologies for the misunderstanding: I multiplied only the coloured rows because they were matches. I merged the cells and it looked like the uncoloured cells were also part of the output, when in fact they weren't. I prepared an Excel but I couldn't upload it and had to attach the screenshot as on my working laptop I am not allowed to install xl2bb.

Now, whereas this solves the better part of my task, I would like to optimize the output and see only the grouped results. This means that I have to exclude duplicate outputs, e.g. apple>big>yellow should be displayed only once, the other row should be excluded. This is needed because this new table with the output is the input for further calculations down the road. I don't see a way to this in excel but in VBA should be no problem. What do you think, how could this problem be solved in the best way?

Best
Evgeni
 

Attachments

  • ProdukcFilterGrouped.PNG
    ProdukcFilterGrouped.PNG
    18.7 KB · Views: 2
Upvote 0
Give this a try...
MrExcel_20220505B.xlsx
ABCDEFGHI
2Group 1Group 2Group 3ValuesPost #1 ResultMy ResultNon Excel 365Non Excel 365 & check for prior match
3applesmallgreen55555
4applesmallred1010101010
5applebigyellow15225225225225
6applebigyellow15225225225 
7applemiddleyellow1515151515
8applesmallyellow1515151515
9breadbigrye2020202020
10breadmiddlerye20400400400400
11breadmiddlerye20400400400 
12breadsmallspelt25625625625625
13breadbigspelt25625252525
14breadmiddlespelt25625252525
15breadsmallspelt25625625625 
16breadsmallwheat30900900900900
17breadsmallwheat30900900900 
18breadbigwheat3030303030
19breadmiddlewheat3030303030
20pearbigbrown3535353535
21pearmiddlebrown3542875428754287542875
22pearmiddlebrown35428754287542875 
23pearsmallgreen542875555
24pearsmallyellow1542875151515
25pearmiddleyellow1542875151515
26pearmiddlebrown35428754287542875 
Sheet8
Cell Formulas
RangeFormula
G3:G26G3=PRODUCT(FILTER($D$3:$D$26,($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)))
H3:H26H3=PRODUCT(IFERROR(($D$3:$D$26)/(($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)),""))
I3:I26I3=IF(SUMPRODUCT(($A$2:$A2=$A3)*($B$2:$B2=$B3)*($C$2:$C2=$C3))>0,"",PRODUCT(IFERROR(($D$3:$D$26)/(($A$3:$A$26=$A3)*($B$3:$B$26=$B3)*($C$3:$C$26=$C3)),"")))
 
Upvote 0
Solution
Awesome work! KRice, you saved me tons of time, much appreciated! :)
P.S. I use Office 365, sorry for overlooking your question before...
 
Upvote 0
I'm happy to help, and thanks for letting me know. You should update your account details to indicate you use Excel 365, as solutions offered can, and often do, depend on whether the enhanced functions in 365 are available.
 
Upvote 0

Forum statistics

Threads
1,216,113
Messages
6,128,905
Members
449,478
Latest member
Davenil

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