SOLVED

Median and mode with criteria

%3CLINGO-SUB%20id%3D%22lingo-sub-3008110%22%20slang%3D%22en-US%22%3EMedian%20and%20mode%20with%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3008110%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20anyone%20tell%20me%20how%20to%20find%20the%20median%20and%20the%20mode%20of%20values%20with%20criteria%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20an%20example%20of%20what%20I%20mean%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20the%20left%20is%20a%20list%20of%20products%2C%20their%20colors%20and%20prices.%20On%20the%20table%20on%20the%20right%20I%20want%20to%20get%20the%20median%20and%20mode%20of%20the%20price%20of%20the%20products%20that%20are%20a%20specific%20color%20(in%20this%20case%20blue).%20But%20the%20catch%20is%20that%20I%20want%20it%20to%20do%20it%20automatically%2C%20so%20every%20time%20I%20add%20a%20product%20I%20dont%20have%20to%20select%20it%20myself%2C%20but%20instead%20the%20function%20checks%20the%20list%20of%20colors%20and%20then%20looks%20up%20the%20prices%20next%20to%20the%20specific%20color%20and%20returns%20the%20media%2Fmode%20of%20those%20prices.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22UsefulDragon_0-1637921535473.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F329667i9B7DBC62732FC0CC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22UsefulDragon_0-1637921535473.png%22%20alt%3D%22UsefulDragon_0-1637921535473.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%C2%B4ve%20attached%20a%20file%20if%20it%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20very%20much!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3008110%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3008174%22%20slang%3D%22en-US%22%3ERe%3A%20Median%20and%20mode%20with%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3008174%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1229713%22%20target%3D%22_blank%22%3E%40UsefulDragon%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DAVERAGE(IF(Table1%5BColor%5D%3D%5BProduct%20color%5D%2CTable1%5BPrice%5D))%3C%2FP%3E%3CP%3E%3DMODE(IF(Table1%5BColor%5D%3D%5BProduct%20color%5D%2CTable1%5BPrice%5D))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20this%20what%20you%20are%20looking%20for%3F%20Enter%20the%20formulas%20with%20ctrl%2Bshift%2Benter%20if%20you%20don't%20work%20with%20Office365%20or%202021.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3008306%22%20slang%3D%22en-US%22%3ERe%3A%20Median%20and%20mode%20with%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3008306%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1229713%22%20target%3D%22_blank%22%3E%40UsefulDragon%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20the%20permission%20of%20those%20involved%2C%20even%20if%20Mr.%20(Quadruple%20Pawn)%20Oliver%20Scheurich%20suggested%20solution%20is%20most%20suitable%2C%20here%20is%20an%20additional%2C%20simplified%20suggested%20solution%20with%20conditional%20formatting.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Fuse-conditional-formatting-to-highlight-information-fed60dfa-1d3f-4e13-9ecb-f1951ff89d7f%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EUse%20conditional%20formatting%20to%20highlight%20information%3C%2FA%3E%3C%2FP%3E%3CP%3ESample%20file%20with%20ready-made%20formats%2C%20only%20need%20to%20enter%20the%20color%20as%20text.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20understanding%20and%20time%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolinoDE%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi

 

Can anyone tell me how to find the median and the mode of values with criteria?

 

Here is an example of what I mean:

 

On the left is a list of products, their colors and prices. On the table on the right I want to get the median and mode of the price of the products that are a specific color (in this case blue). But the catch is that I want it to do it automatically, so every time I add a product I dont have to select it myself, but instead the function checks the list of colors and then looks up the prices next to the specific color and returns the media/mode of those prices.

 

UsefulDragon_0-1637921535473.png

 

I´ve attached a file if it helps.

 

Thank you very much!

3 Replies
best response confirmed by UsefulDragon (Occasional Contributor)
Solution

@UsefulDragon 

=AVERAGE(IF(Table1[Color]=[Product color],Table1[Price]))

=MODE(IF(Table1[Color]=[Product color],Table1[Price]))

 

Is this what you are looking for? Enter the formulas with ctrl+shift+enter if you don't work with Office365 or 2021.

@UsefulDragon 

With the permission of those involved, even if Mr. (Quadruple Pawn) Oliver Scheurich suggested solution is most suitable, here is an additional, simplified suggested solution with conditional formatting.

 

Use conditional formatting to highlight information

Sample file with ready-made formats, only need to enter the color as text.

 

Thank you for your understanding and time

 

NikolinoDE

I know I don't know anything (Socrates)

 

Exactly, thank you!