Finding the MODE in Excel with VLOOKUP? - excel

I have a question about finding the MODE in excel. The table below shows 4 different income brackets and then how many families are in each bracket
I wanted to ask if its possible to find the MODE of the data set bellow without having to write it down like i did on the right side of the table?
I tried using MAX to find the largest number of families in a single income bracket and then using VLOOKUP to find the corresponding value in the other column, but for some reason it does not work.

Use this formula instead
=VLOOKUP(MAX(B23:B26),CHOOSE({1,2},B23:B26,A23:A26),2,0)
Actually, one of the vlookup()'s limitation is to read the array from left to right only. In your problem, you have lookup values on the right side and values to return on the left. CHOOSE function here does the job for reversing the data/array for you.
GOOD LUCK

Related

How to find first unique value in a column of SKU?

So I have two columns, A & B, (like below). There's 2 components to the ID, the design (CEN101A) and the size (-6).
I'm trying find the first item of each design. So in this example, I would highlight (CEN106A-6, CEN101B-6, CEN101D-6, etc.). This is so I can use them as a parent for the other sizes.
I've tried many in-built functions but nothing seems to work. Is VBA able to easily find these values?
#BigBen is right, this is fairly easy if you can find what the actual design code is. For good measure I'd use a running count and add the hyphen back including a wildcard into the COUNTIF():
Formula for conditional formatting rule on range A2:A7:
=COUNTIF(A$2:A2,#TEXTSPLIT(A2,"-")&"-*")=1
Without TEXTSPLIT(), use a combo of LEFT() and FIND() as per the comment by #P.b:
=COUNTIF(A$2:A2,LEFT(A2,FIND("-",A2))&"*")=1

Excel percentage increase based on formula

I am trying to fill the sell price column in an Excel spreadsheet with the increased values in colors based on the round up columns value (1 to 50 green, 50 to 100 blue, 100 to 150 yellow, 150+ pink).
I've opted for the percentage table because some items can be sold for a lot more than what I have purchased them for, so that's just for my benefit. I am open to any other suggestions and I am new to this whole business thing.
I was using IF in my formula which would work great for using one percentage increase in the formula:
=IF($E27<50,ROUNDUP(I$27,-1))
If I try to enter a second argument like
=IF(OR($E28<50,ROUNDUP(I$28,-1)OR($E28>50,<100,ROUNDUP(J$28,-1))))
I will get an error.
I'm probably using the formulas wrong, I've tried "AND" and a couple other formulas, but I can't find anyone else trying to achieve the same or similar.
So something like this:
=IF($E28<50,ROUNDUP(I$28,-1),IF($E28>50,ROUNDUP(J$28,-1),"Error"))
But not sure what the <100 was for.
Although the problem is not completely clear, I understand that you want to add a formula with nested if statements.
I will recommend you to try nested ifs in parts.
=IF($E27<50,ROUNDUP(I$27,-1),"First if condition is false")
If everything is working as per the requirement then edit that text in the formula to add another if statement.
=IF($E27<50,ROUNDUP(I$27,-1),IF(OR(condition 1, condition 2,more conditions),"value if true","value if false"))
In the second argument provided by you, the arguments of the OR function has not been properly provided. Ensure that all the arguments of an OR function are conditions separated by a comma.
$E28<50 This is a condition so it's ok.
But other arguments are not making sense.
Also, using OR multiple times inside the first OR arguments is not clear.
It would be beneficial if you could provide the basic table and mention the requirement clearly.

Excel - Index/Match to Parse Column Data Until Desired Value Shows

I'm not sure the best way to word this question, but basically I have a big list of different names and IDs that will be visited multiple times with data pulled from a Survey123 form. One of the fields is asking if a part has been repaired, which will be no a maximum of 3 times before turning yes.
I'm using Index/Match to keep track of the dates the visits took place, but if I try it for the repair column it will always just return the first value in the repair column. Is there a way I can have it parse all the repair column values and change the result if it is Yes?
Here is a visual of what I'm trying to achieve, using Index/Match will stop at the first result rather than cycling through.
You may try below formula. If any of visit has Yes in repaired column then it will return Yes or will return No.
=IF(SUMPRODUCT((A3:A5=F3)*(B3:B5=G3)*(D3:D5="Yes"))>0,"Yes","No")
Or you can use XLOOKUP() with Search_Mode option -1 means search last to first order.
=XLOOKUP(1,(A3:A5=F3)*(B3:B5=G3),D3:D5,"",0,-1)
You can use FILTER to achieve this
=FILTER(C2:C4,(A2:A4=F4)*(B2:B4=G4)*(C2:C4="Yes"),"No")

Taking means of irregular amounts data

I'm not able to take the means for a large dataset given that the amount of attributes is irregular.
I have posted a simplified case for the problem. It explains the problem very well.
An idea that I came up with: Make a filter to condition on a single attribute. However, still, I don't see a way to do this in an efficient way (other then doing it all by hand).
see excel file:
All help is much appreciated.
I'm basically looking for a function/method to achieve taking means of all different attributes conditioned on each person for a large dataset without doing it by hand.
You can use AVERAGEIFS() inside an IF:
=IF(OR(A2<>A1,B2<>B1),AVERAGEIFS(C:C,A:A,A2,B:B,B2),"")
the ifrst part of the if tests whether the row starts a new group either by the person or the attribute changing. Then it uses AVERAGEIFS() to return the correct average of that group. otherwise it returns a blank
What you want to do can be accomplished very simply with a pivot table.
Simply select one of the cells inside the range of data you want to process(See the video for general use of a pivot table https://www.youtube.com/watch?v=iCiayB6GrpQ )
go the insert tab and insert pivot table.
Once you have it, simply check people, attribute, and values. Then drag people and attribute into rows, drag valut into the values window, select the drop down list and change it from sum of value to average and you should be done. https://i.stack.imgur.com/nYEzw.png

Finding the right range from excel table

What is the best way to find the right column for the travelled miles using visual basic coding or some excel function and return the price from that column? HLOOKUP can't be used here because the lookup value isn't exact and the ranges in the table are also not with specific intervals (If they were, I could use e.g. FLOOR(travelled miles/100)*100 and find the price with HLOOKUP). Obviously, it's easy to find the price manually with a small table but with a big table computer will be faster.
Note that, if x is between a and b, then MEDIAN(x,a,b)=x. Combine this with some nested IFs:
=IF(MEDIAN(B5,B1,C1-1)=B5,B2,IF(MEDIAN(B5,C1,D1-1)=B5,C2,IF(MEDIAN(B5,D1,E1-1)=B5,D2)))
I'm on my phone, so just done the first three cases, but hopefully you can see how it continues.
(should note you need to remove the dashes for this to work)
Edit:
I also want to answer your question in the comments above. You can use the following to keep the dash, but get a number to work with.
Assume cell A1 has got the value 10-. We can use the FIND function to work out where the - occurs and then use the LEFT function to only return the characters from before the dash:
=LEFT(A1,FIND("-",A1)-1)
This will return the value 10, but it will return it as a string, not a number - basically Excel will think it is text. To force Excel to consider it as a number, we can simply multiply the value by one. Our formula above therefore becomes:
=(LEFT(A1,FIND("-",A1)-1))*1
You may also see people use a double minus sign, like this:
=--LEFT(A1,FIND("-",A1)-1)
I don't recommend this because it's a bit complex, but combining with the formula above would give:
=IF(MEDIAN(B5,--LEFT(B1,FIND("-",B1)-1),--LEFT(C1,FIND("-",C1)-1)-1)=B5,B2,IF(MEDIAN(B5,--LEFT(C1,FIND("-",C1)-1,--LEFT(D1,FIND("-",D1)-1-1)=B5,C2,IF(MEDIAN(B5,--LEFT(D1,FIND("-",D1)-1,--LEFT(E1,FIND("-",E1)-1-1)=B5,D2)))

Resources