SOLVED

Excel Challenge

%3CLINGO-SUB%20id%3D%22lingo-sub-1506804%22%20slang%3D%22en-US%22%3EExcel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1506804%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20big%20problem%20in%20writing%26nbsp%3B%3CBR%20%2F%3EExcel%20formula%20for%20the%20following%20problem%3A%3C%2FP%3E%3CP%3EI%20have%20Three%20feature%20of%20my%20costumer%20I%20want%20to%20separate%20my%20costumers%20by%20these%3CBR%20%2F%3Ethree%20features%20and%20give%20them%20Index%201%2C%202%20and%203%2C%3C%2FP%3E%3CP%3EFor%20Costumers%20which%20they%20have%20A%20feature%20give%201%20index%3C%2FP%3E%3CP%3EFor%20costumers%20which%20they%20have%20B%20feature%20give%202%20Index%3C%2FP%3E%3CP%3Eand%20for%20the%20costumers%20which%20they%20have%20A%20and%20B%20(both%20of%20them)%20give%20the%203%20index%3C%2FP%3E%3CP%3Ealso%20I%20send%20attachments%2C%3C%2FP%3E%3CP%3EHow%20I%20can%20do%20this%20in%20Excel%20%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Excel%20PIC.png%22%20style%3D%22width%3A%20436px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F203919i410AFB09E96714E9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Excel%20PIC.png%22%20alt%3D%22Excel%20PIC.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20appreciate%20for%20your%20guide%20in%20advance%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1506804%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1506897%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1506897%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F244734%22%20target%3D%22_blank%22%3E%40Jalal_1988%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAre%20you%20able%20to%20reorganize%20the%20data%20to%20a%20cleaner%20table%2C%20as%20in%20the%20attached%3F%20If%20so%2C%20a%20simple%20IFS%20formula%20gives%20the%20resulting%20%22Index%22%20value.%26nbsp%3B%26nbsp%3B%20In%20general%2C%20if%20it's%20possible%20for%20all%20your%20data%2C%20you're%20better%20off%20having%20any%20one%20customer%20occupy%20only%20one%20row.%20Especially%20where%20the%20only%20differences%20have%20to%20do%20with%20one%20or%20two%20elements%20of%20information%2C%20because%20they%20can%20be%20handled%20by%20different%20columns%20on%20the%20same%2C%20single%20row.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20there's%20some%20other%20compelling%20reason%20to%20have%20multiple%20rows%20per%20person%2C%20please%20spell%20that%20out.%20You%20might%20then%20be%20better%20served%20by%20having%20two%20or%20more%20tables%2C%20connecting%20them%20via%20Power%20Query%20or%20some%20other%20feature.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20attached%20the%20spreadsheet%2C%20but%20here's%20an%20image%20for%20your%20review.%20The%20formula%20is%20visible%20as%20well.%20That%20formula%20is%20just%20copied%20down%20to%20the%20other%20rows.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mathetes_0-1594149063215.png%22%20style%3D%22width%3A%20687px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F203931iF6518DBD1C508388%2Fimage-dimensions%2F687x280%3Fv%3D1.0%22%20width%3D%22687%22%20height%3D%22280%22%20title%3D%22mathetes_0-1594149063215.png%22%20alt%3D%22mathetes_0-1594149063215.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1506928%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1506928%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F244734%22%20target%3D%22_blank%22%3E%40Jalal_1988%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DMMULT(--(COUNTIFS(%24B%242%3A%24B%2417%2CB2%2C%24A%242%3A%24A%2417%2C%7B%22A%22%2C%22B%22%7D)%26gt%3B0)%2C%7B1%3B2%7D)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1507159%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1507159%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1639%22%20target%3D%22_blank%22%3E%40Detlef%20Lewin%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMMULT%20is%20a%20function%20I'd%20not%20seen%20before.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFrankly%2C%20the%20Help%20text%20on%20the%20function%20isn't%20very%20helpful%20in%20understanding%20it.%20Can%20you%20explain%20how%20it's%20working%20here%20to%20solve%20the%20question%20asked%20by%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F244734%22%20target%3D%22_blank%22%3E%40Jalal_1988%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1507301%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1507301%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20good%20at%20explaining%20MMULT().%20So%20I%20have%20to%20refer%20to%20the%20support%20page.%20The%20key%20text%20is%3A%26nbsp%3BThe%20result%20is%20an%20array%20with%20the%20same%20number%20of%20rows%20as%20array1%20and%20the%20same%20number%20of%20columns%20as%20array2.%3C%2FP%3E%3CP%3Earray1%20has%20one%20row%20(and%20two%20columns)%20and%20array2%20has%20one%20column%20(and%20two%20rows).%20So%20the%20output%20is%20an%20array%20with%20one%20row%20and%20one%20column.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1507336%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1507336%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1639%22%20target%3D%22_blank%22%3E%40Detlef%20Lewin%3C%2FA%3E%26nbsp%3B%20that%20is%20a%20clever%20solution%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%20mmulti()%20stands%20for%20matrix%20multiply%20which%20goes%20back%20to%20linear%20algebra%20days.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3EI%20started%20to%20try%20and%20explain%20it%20here%20but%20you%20would%20be%20much%20better%20served%20with%20a%20website%20designed%20to%20teach%20it%20like%20%3CA%20href%3D%22https%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26amp%3Brct%3Dj%26amp%3Bq%3D%26amp%3Besrc%3Ds%26amp%3Bsource%3Dweb%26amp%3Bcd%3D%26amp%3Bcad%3Drja%26amp%3Buact%3D8%26amp%3Bved%3D2ahUKEwj2y6HcmrzqAhUFLs0KHfvBDbUQFjAAegQIAhAB%26amp%3Burl%3Dhttps%253A%252F%252Fwww.mathsisfun.com%252Falgebra%252Fmatrix-multiplying.html%26amp%3Busg%3DAOvVaw2H0BMrqG1AOypxo5VF-pz8%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethis%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1507674%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1507674%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20that%20link.%20I'm%20printing%20the%20page%20now%20for%20careful%20study.....and%20then%20I'll%20keep%20my%20eyes%20open%20for%20opportunities%20to%20apply%20MMULTI.%20It's%20in%20the%20using%20that%20it'll%20really%20(finally)%20make%20sense.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1507716%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1507716%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20use%20can%20be%20to%20create%20an%20array%20of%20subtotals%20for%20use%20in%20an%20array%20formula%20or%20lookup%20formula%20where%2C%20for%20whatever%20reason%2C%20you%20don't%2Fcan't%20have%20a%20subtotal%20helper%20column.%20So%2C%20if%20you%20had%20numbers%20in%20A1%3AA10%2C%20and%20entered%20this%20in%20B1%3AB10%2C%20you%20would%20get%20a%20subtotal%20array%20(credit%20to%20Harlan%20Grove)%3A%3C%2FP%3E%3CP%3E%3DMMULT(--(ROW(A1%3AA10)%26gt%3B%3DTRANSPOSE(ROW(A1%3AA10)))%2CA1%3AA10)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20an%20expert%20on%20it's%20use%2C%20but%20I've%20used%20it%20in%20situations%20where%20I%20needed%20an%20OR%20criteria%20in%20an%20array%20calculation%2C%20but%20it%20had%20to%20be%20condensed%20into%20a%20single%20dimension%20array%20(instead%20of%20leaving%20it%202D%20and%20multiplying%20it%20out-sometimes%20the%20other%20parts%20of%20the%20formula%20were%20also%20OR%20criteria%20with%20different%20dimensions%20and%20the%20normal%20array%20multiplication%20wouldn't%20work%20and%20MMULT%20was%20more%20compact%20than%20the%20usual%20array%20addition%20I%20would%20use%20for%20OR).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20an%20example%20file%20of%20using%20mmult%20on%20a%202D%20data%20table%20with%20multiple%20OR%20criteria%20in%20both%20dimensions.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1507721%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Challenge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1507721%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1639%22%20target%3D%22_blank%22%3E%40Detlef%20Lewin%3C%2FA%3E%26nbsp%3BThanky%20you%20Dear%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1639%22%20target%3D%22_blank%22%3ELewin%20%2C%20I%20used%20your%20approach%20to%20solve%20my%20problem%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

I have big problem in writing 
Excel formula for the following problem:

I have Three feature of my costumer I want to separate my costumers by these
three features and give them Index 1, 2 and 3,

For Costumers which they have A feature give 1 index

For costumers which they have B feature give 2 Index

and for the costumers which they have A and B (both of them) give the 3 index

also I send attachments,

How I can do this in Excel ?

Excel PIC.png

I appreciate for your guide in advance,

8 Replies
Highlighted

@Jalal_1988 

 

Are you able to reorganize the data to a cleaner table, as in the attached? If so, a simple IFS formula gives the resulting "Index" value.   In general, if it's possible for all your data, you're better off having any one customer occupy only one row. Especially where the only differences have to do with one or two elements of information, because they can be handled by different columns on the same, single row.

 

If there's some other compelling reason to have multiple rows per person, please spell that out. You might then be better served by having two or more tables, connecting them via Power Query or some other feature.

 

I've attached the spreadsheet, but here's an image for your review. The formula is visible as well. That formula is just copied down to the other rows.

mathetes_0-1594149063215.png

 

Highlighted
Solution

@Jalal_1988 

=MMULT(--(COUNTIFS($B$2:$B$17,B2,$A$2:$A$17,{"A","B"})>0),{1;2})
Highlighted

@Detlef Lewin 

 

MMULT is a function I'd not seen before.

 

Frankly, the Help text on the function isn't very helpful in understanding it. Can you explain how it's working here to solve the question asked by @Jalal_1988

Highlighted

@mathetes 

I'm not good at explaining MMULT(). So I have to refer to the support page. The key text is: The result is an array with the same number of rows as array1 and the same number of columns as array2.

array1 has one row (and two columns) and array2 has one column (and two rows). So the output is an array with one row and one column.

 

Highlighted

@Detlef Lewin  that is a clever solution

@mathetes  mmulti() stands for matrix multiply which goes back to linear algebra days.  

I started to try and explain it here but you would be much better served with a website designed to teach it like this

Highlighted

@mtarler 

 

Thanks for that link. I'm printing the page now for careful study.....and then I'll keep my eyes open for opportunities to apply MMULTI. It's in the using that it'll really (finally) make sense.

Highlighted

@mathetes 

 

One use can be to create an array of subtotals for use in an array formula or lookup formula where, for whatever reason, you don't/can't have a subtotal helper column. So, if you had numbers in A1:A10, and entered this in B1:B10, you would get a subtotal array (credit to Harlan Grove):

=MMULT(--(ROW(A1:A10)>=TRANSPOSE(ROW(A1:A10))),A1:A10)

 

I'm not an expert on it's use, but I've used it in situations where I needed an OR criteria in an array calculation, but it had to be condensed into a single dimension array (instead of leaving it 2D and multiplying it out-sometimes the other parts of the formula were also OR criteria with different dimensions and the normal array multiplication wouldn't work and MMULT was more compact than the usual array addition I would use for OR). 

 

Here's an example file of using mmult on a 2D data table with multiple OR criteria in both dimensions. 

 

 

 

 

Highlighted