Excel - Location and prioritisation of values in a range - excel-formula

Hi and thanks very much for taking the time to read/respond.
I'm struggling with trying to adapt a very advance formula given by tigeravatar here: tigeravatar
I have an almost identical issue, but have the following possible states:
A, B, C, D, and corresponding levels of priority.
In a given range, multiple entries in any of these four categories could be made. But I need to return only the highest value regardless of all other entries.
Here's the original formula.
=INDEX({"","D","C","B","A"},MATCH(SUMPRODUCT({4,3,2,1},--(COUNTIF('Sheet 002'!E29:E32,{"A","B","C","D"})>0)),{0,1,2,3,4}))
The only problem being that in the formula above if B and C co-occur it displays A, and if B and C only display if they occur in isolation.
Thanks in advance for your and any inputs you're willing to share!

If you were willing to have a helper column, you could convert the letters to numbers using =CODE(). This column can then be ranked by taking the minimum (A=65, B=66, etc.) Note that CODE() is case-sensitive. You can find the highest ranking letter by using a formula like this:
=INDEX(E29:E32,MATCH(MIN(F29:F32),F29:F32,0))
Screenshot

Related

Excel Find Max of Strings omitting rows

With the above arrangement of data, I desired an excel formula to find out the max of the strings in column A, ignoring rows for which column B is identified as "Inserted". So, in this example, the formula should yield "Sleep" as that's the maximum string from lexical sorting perspective i.e. Sleep is greatest amongst Sleep, Drink, Fish and Eat
My issue is perhaps different from the traditional index/match solution as I have to skip rows based on the condition in column B
Any help is highly appreciated.
Thanks

How do I find the sum of the values of a colum in Libreoffice Calc (or excel)?

I have date column H, and values in K, and I want to find the sum of the VALUES in K --if H is today.
I tried =COUNTIFS(K:K,"<>",H:H,">="&TODAY())
which gives me the number of entries today, but NOT the sum of their values!
Also, when searching I found some suggestions talking about greater/lesser than today, but I'm looking to compute Today only!
Here is some reading material about SumIfs ...
=SUMIFS(K:K,H:H,TODAY())
I prefer SUMPRODUCT for this.
= SUMPRODUCT(K:K,(H:H=TODAY())+0)
I recommend narrowing down the full column ranges to where ever your data actually ends (e.g. if you have 100 rows of data, change K:K to K1:K100).
=SUMIFS(K2:K500,H2:H500,TODAY())
First column is text labels, therefore not included.

Match/VLOOKUP with Embedded IF statement to return one of two columns?

I've looked high and low for this formula but nothing seems to come close. I would really appreciate the help. In Worksheet 1 I have a list of names. In Worksheet 2, I have column A with names, column B with yes/no, column C with valueA, and column D with valueB. What I want to do is look up the name in worksheet 2 (could be MATCH or VLOOKUP, I think), and once the name is found, check if column B is yes or no. If yes, return column C's valueA. If no (or FALSE), return column D's valueB. Any ideas??
The two most common ways of doing lookups in Excel are VLOOKUP (or HLOOKUP), or a combination of INDEX and MATCH. The latter method is slightly more complex, but more flexible.
Applying it to your problem, you need to perform a lookup three times, within an IF formula: if looking up Column B yields YES, look up Column C, else look up Column D. So it might look like this:
=IF(INDEX(Sheet2!B:B,MATCH(Sheet1!A1,Sheet1!A:A,0))="yes",INDEX(Sheet2!C:C,MATCH(Sheet1!A1,Sheet1!A:A,0)),INDEX(Sheet2!D:D,MATCH(Sheet1!A1,Sheet1!A:A,0)))
In future, give it a shot on your own - to whatever extent you're able - and then paste your working here so we can help you improve it!

Taking average of certain values in one Excel column based on values in another

I have a (large) array of data in Excel of which I need to compute the average value of certain values in one column, based on the values of another column. For example, here's a snippet of my data:
So specifically, I want to take the average of the F635 mean values corresponding with Row values of 1. To take it a step further, I want this to continue to Row values of 2, Row values of 3 etc.
I'm not familiar with how to run code in Excel but have attempted to solve this by using the following:
=IF($C = "1", AVERAGE($D:$D), "")
which (to my understanding) can be interpreted as "if the values (anywhere) in column C are equal to 1, then take the average of the corresponding values in column D."
Of course, as I try this I get a formula error from Excel.
Any guidance would be incredibly appreciated. Thanks in advance.
For more complicated cases, I would use an array-formula. This one is simple enough for the AVERAGEIF formula. For instance =AVERAGEIF(A1:A23;1;B1:B23)
Array-formula allows for more elaborate ifs. To replicate the above, you could do =SUM(IF($A$1:$A$23=1;$B$1:$B$23;0))/COUNT(IF($A$1:$A$23=1;$B$1:$B$23;0)).
Looks like more work but you can create extremely elaborate if-statements. Instead of hitting ENTER, do CTRL-ENTER when entering the formula. Use * between criteria to replicate AND or + for OR. Example: SUM(IF(($A$1:$A$23="apple")*($B$1:$B$23="green");$C$1:$C$23;0)) tallies values for green apples in c1:c23.
Your sample data includes three columns with potential ifs so my guess is that you're going to need array formulas at some point.
Excel already has a builtin function for exactly this use; AVERAGEIF().
=AVERAGEIF(C:C,1,D:D)

Deal with a variable number of samples associated with identificative values

I'm a new member and not an Excel ace!
My problem is that I've (for example, the dataset is much larger) five identification values (id1,id2,id3,id4,id5) in the column A which identify a cast. In column B I've 19 samples for the 5 casts in column A. However, in each cast the sample size vary from 2 to 6. So, I want to obtain 19 values in the way that each cast identification value correspond to its number of samples. In the end I want to have this kind of column A with the identification values (id1,id1,id2,id2,id2,id2,id3,id3,id3,id3,id3,id4,id4,id4,id4,id4,id4,id5,id5) which correspond with the column B with the number of samples (1,2,1,2,3,4,1,2,3,4,5,1,2,3,4,5,6,1,2). So, I want each identification value to correspond to the number of its samples.
Thank you!
I think you might be best served by instead creating a "CAST+Sample" column that would uniquely identify each row. However the below, entered into A3 should produce the desired effect from your example.
=IF(B3=1,"ID"&VALUE(RIGHT(A1,1))+1,A2)
This will only work when there are less than 10 Casts.
Okay, so it was worth giving example data. Assuming your Sample is in column B and you want your ID's in column A. Put this formula in cell A2 and drag till you have your Sample.
=IF(VALUE(B2)=1,IF(LEFT(A1,2)="ID","ID"&RIGHT(A1,LEN(A1)-2)+1,"ID1"),IF(LEFT(A1,2)="ID",A1,"ID1"))
Here is the screenshot of how it will look after you place this formula.

Resources