VLOOKUP query help required - count from a range - excel

I'm trying to build a spreadsheet to help automate points scoring for an office F1 fantasy league we have.
I've attached an example data set, but basically I need to search a range, then count how many times the constructor appears in the numbered positions (discounting R, D as they've not finished), then carry this over to the standings.
I also need to do something similar for the top 10 which says if 2 cars from the same constructor (Mercedes, Mercedes) appear in positions 1-10 then add points to the standings.
In the working model the data for race1 is direct from the BBC via web query, so how they appear with 'driver' in between is how it must remain (I also have other actions running which lookup the driver info, so can't be moved).
I've popped the example on my drive here and updated version.

You need to be consistent with spellings or this won't work, but for standings B2 you might try:
=IF(COUNTIFS(race1!C:C,A2,race1!A:A,"<>D",race1!A:A,"<>R")=2,20,IF(COUNTIFS(race1!C:C,A2,race1!A:A,"<>D",race1!A:A,"<>R")=1,7,-15))
and in C2:
=COUNTIF(race1!$C$2:$C$11,A2)*10
both copied down to suit.
Edit for number of cars in column B change first formula to:
=COUNTIFS(race1!C:C,A2,race1!A:A,"<>D",race1!A:A,"<>R")
and for points put first formula in C2 (copy both down to suit).

Related

Match and Conditional Formatting from Matrix Table

I am looking for some decent help with my matrix table, and is there a good or best approach to properly match dependent instances in certain matrix using drop downs.
This picture represents my matrix table (Picture 1):
As you can see there are a lot of instances, but horizontally and vertically they got the same number of "headers". Those "1`s" are representing not compatibility in my case but lets call it simply "match". That is on one sheet that is gonna be populated with some new values from time to time.
On another sheet which is actually sheet for showing the data and their compatibility possibilities is equipped with drop downs. There you got "Groups (Group1, Group2...)" in a sense of main parts and "dependent groups (AA1, BB2..)" as small components that are part of main parts. To avoid misunderstanding here you have explanations, I used for the sake of this example fictional values:
Groups aka. Main Parts
Dependent groups aka. components
As you can see beneath, is my fictional table but exactly the same concept as I should use in my real case.
I PUT AN EXPLANATION IN THE PICTURE 2 SO YOU CAN FOLLOW ALONG AND SEE EXACTLY WHERE/WHAT I DID!
What I used firstly there are =match functions, one for vertical position (A3) and one for horizontal (B4). This boolean row is done using =or(index) but reffering to the match positions as you can see. And from there I should use true/false for coloring my group boxes in a case compatibility is possible - thats all the science.
So, my question is if there is another approach to this problem? As you can see I have 3 different rows of functions at one place, or imagine if I will have more "groups" that can rise in many more rows and calculations.
Picture 2
EDITED:
This is screenshot of the original sheet, I just hid some rows that were with Infos that is reason the number is not consistent. As you can see it is almost the same as dummy example I provided above. Underneath every "box" you got three rows of calculations as I mentioned before. The two times number "2" that you see here is the position of some value that I found using =match function, one is for horizontal and another for vertical lookup. In this case it is model type, 070FX is position 2, 100FX is 3 and 200FX is 4th position in the matrix table, and so on for all the other groups. And those groups (Model, Endpoint, Gas sensor...) are defined separately on another sheet where I had to make unique list and dependent list so I can reference those to my drop down list.
EDIT Nr 4! So this formula I used for true/false:
=SUMPRODUCT(('0359-matrix'!$A$2:$A$101=F10)*(('0359-matrix'!$B$1:$CW$1=$B$10)+('0359-matrix'!$B$1:$CW$1=$C$10)+('0359-matrix'!$B$1:$CW$1=$D$10)+('0359-matrix'!$B$1:$CW$1=$E$10)+('0359-matrix'!$B$1:$CW$1=$F$10)+('0359-matrix'!$B$1:$CW$1=$G$10)+('0359-matrix'!$B$1:$CW$1=$H$10)+('0359-matrix'!$B$1:$CW$1=$I$10)+('0359-matrix'!$B$1:$CW$1=$J$10)+('0359-matrix'!$B$1:$CW$1=$K$10)+('0359-matrix'!$B$1:$CW$1=$L$10)+('0359-matrix'!$B$1:$CW$1=$M$10)+('0359-matrix'!$B$1:$CW$1=$N$10)+('0359-matrix'!$B$1:$CW$1=$O$10)+('0359-matrix'!$B$1:$CW$1=$P$10)+('0359-matrix'!$B$1:$CW$1=$Q$10)+('0359-matrix'!$B$1:$CW$1=F13)+('0359-matrix'!$B$1:$CW$1=G13)+('0359-matrix'!$B$1:$CW$1=H13)+('0359-matrix'!$B$1:$CW$1=I13)+('0359-matrix'!$B$1:$CW$1=J13))*'0359-matrix'!$B$2:$CW$101)>0
I copied only last part, or when it starts from second row..Because it is too long to write whole funciton - it cuts down automatically.
('0359-matrix'!$B$1:$CW$1=$Q$10)+('0359-matrix'!$B$1:$CW$1=$B$13)+('0359-matrix'!$B$1:$CW$1=$C$13)+('0359-matrix'!$B$1:$CW$1=$D$13)+('0359-matrix'!$B$1:$CW$1=$E$13)+('0359-matrix'!$B$1:$CW$1=$F$13))*'0359-matrix'!$B$2:$CW$101)>0
But on marked cells I am getting the same results: B22 - F22 has the same as B21 - F21 (boolean) what shouldnt be like that but to follow color, green is False, it has to be something with an array reference.
Checkout the following. A1 to E5 is the matrix that shows which pieces are incompatible (=1). The others have to be empty or 0.
In cell I8 I used the following formula (and copied it down up to I11):
=SUMPRODUCT(($A$2:$A$5=H8)*(($B$1:$E$1=$H$8)+($B$1:$E$1=$H$9)+($B$1:$E$1=$H$10)+($B$1:$E$1=$H$11))*$B$2:$E$5)
The formula result shows you the amount of incompatibilities a part has. Eg AA1 has one incompatibility with BB2 but BB2 is incompatible with 2 AA1 and CC3.
To get the TRUE/FALSE use the same formula and append >0: like =SUMPRODUCT(…)>0
For any additinonal "group" (Model, Endpoint, …) you need to add another +($B$1:$E$1=$H$12) where $B$1:$E$1 points to your matrix data and $H$12 to your selected group value.
Overview of the formula ranges:
Note that this kind of calculation can only tell the amount of incompatibilites a part has but not the names of the parts that are incompatible.
Edited horizontal version
Formula in the selected cell is
=SUMPRODUCT(($A$2:$A$5=G8)*(($B$1:$E$1=$G$8)+($B$1:$E$1=$H$8)+($B$1:$E$1=$I$8)+($B$1:$E$1=$J$8))*$B$2:$E$5)
you can pull it to the right.

Create an Excel Formula that uses filtered data

I'm trying to design a second page that shows % results of my data on page 1.
For example, Column F & G allow manual entry of numbers 1-4 which are based off data the user types in at another location.
This is being used for trade tracking in investments so there will be quite a few numbers but the end result will be a row will show a specific stock, it's subsequent data, whether it made or lost money, etc.
What I want to do in page 2 is using the numbers 1-4 which were typed in at columns F & G, translate that into an edge on page 2.
For example, if there were 50 columns of data typed out for trades executed, I could take the number of winning trades of a certain setup (say number 3) and divide that by the total trades of 50 to come out with a win % for that setup.
However, I have no clue to how to translate that forumla into a filter formula so that on page 2 I could see that of the numbers 1-4 (4 different setups) I could easily see the highest and lowest win % to determine the best setup to use.
I'm not the best in excel but I understand enough to code most of that, I simply have no idea how to take that end formula and add a filter to it so that it only uses partial results. I've got 4 other formulas I want to use on page 2 as well to help build something that could really benefit myself, but if someone could just show me how to filter data into a formula, I think I could take it form there.
Thanks for the help
Ben
You can also do something like this with array formulas
=MAX(IF(Sheet1!$F$2:$F$50=$A2,$E$2:$E$50))
(Press Ctrl+Shift+Enter [CSE], instead of just Enter when entering Array Formulas)
Also, take a look a the SUMPRODUCT function. It comes in very handy for filtering data. Here are some helpful links...
https://www.get-digital-help.com/2017/12/07/sumproduct-multiple-criteria/
https://www.get-digital-help.com/2017/12/08/sumproduct-and-if-function/
https://www.get-digital-help.com/2010/09/01/extract-a-unique-distinct-list-by-matching-items-that-meet-a-criterion-in-excel/

Relabeling Duplicates in Excel of Cells in direct proximity

Apologies for the tile gore - was trying to be descriptive.
I have a large lab result data set, and it has been found that one analyte was screened for twice per sample and i need to capture both sets of results. This results in me having a table similar to below where Antimony is listed twice. Is there a way to automate something either to flag the instances where i have two rows like that or rename to antimony-1 and antimony-2? Since I have 300 sites screened for the same things, everything shows up as duplicate and i can't use the simple methods. The main trigger is the proximity to another row where everything is matching except the results.
If I assume you have the data in you screen shot starting in cell A1 (and Soil as your site) I'd add to columns the first combines Site & Element (Column F in my example):
=A1&C1
Result: SoilAluminium
In the column next to that I'd have a formula:
=F1&COUNTIF($F$1:F1,F1)
Result - SoilAluminium1, SoilAntimony1, SoilAntimony2 etc
Note: Pay Attention to the $'s
I hope that works

using conditional named range in excel

Let me try this again, I've been searching the web and can't seem to find anything. What i'm trying to do is in excel have a bunc of named range list conditional based on a value of another cell. The problem I'm running into character limit when I setup the data validation and put all my IF statements in source textbox. If i just put two conditions it seems to work fine, but that won't work for me. Here is my example data, based on the B column value I want to display the valid sub-items for it. Like I mentioned I have 20 or so different possible values that could be in column B.
B C
1 ENG dropdown of all engineering sub-categories
2 PRO dropdown of all production sub-categories
3 PER ...
4 PAY
5 ENG dropdown of all engineering sub-categories
6 ENG dropdown of all engineering sub-categories
When i try to setup my data validation list on column C1, I put in the following...
=IF($E$5="CAR", CA,
IF($E$5="DCC", DCC,
IF($E$5="ENG", ENG,
IF$E$5="ENV", ENV,
IF$E$5="FBI", BI,
IF$E$5="FGL", GL,
IF$E$5="FAP", AP,
IF$E$5="FRE", AR,
IF$E$5="FTX", Tax,
IF$E$5="ORM", OAR,
IF$E$5="PAY", PAY,
IF$E$5="PIR", PER,
IF$E$5="PRO", PRO,
IF$E$5="PUR", PUR,
IF$E$5="RSK", RM,
IF$E$5="SLM", Sales,
IF$E$5="WFS", WAR)))))))))))))))))
I'm only able to type in maybe half of my IF condition. I tried VLOOKUP but that only allows for 1 value to be put in column C, and I want it to be a dropdown. Any help would be much apprecriated.
You can do this in a much shorter formula by combining VLOOKUP and INDIRECT:
Have you list of of potential names in column B and their corresponding range names somewhere in two columns, e.g. column X & Y:
Col X Col Y
CAR CA
DCC DCC
ENG ENG
ENV ENV
FBI BI
...
Then use the following formula as the source of the list in the Data Validation:
=INDIRECT(VLOOKUP($E$5,$X:$Y,2,0))
Actually, with this approach you can potential even save the effort of naming and maintaining the manual range names! Instead, just replace the name of the named range with the real address - which - with a bit of luck and smart formula engineering - you can derive automatically. This depends on your data structure, but most likely the functions ADDRESS, COUNTA, OFFSET, INDEX and MATCH will be helpful.
E.g. if your lists would be stored in another worksheet with the name of the list in the first row and the elements listed below each header, this example file will provide you the example formulas. One step further, it'll also use conditional highlighting to mark any entry that is invalid, e.g. because the type was changed after the selection:

How to search for a partial and an absolute in excel to get an answer?

I have a worksheet, in where I need a search that does more than one query. The problem I am running into is this:
On the workbook there are two tabs, the first is Jobs, the second is OOR. In OOR there are multiple columns empty, Order Qty., Orig Promise Date, and Shop Order.
Now I know there are duplicates, and this is fine, what I am looking at now is to use Column B in OOR is a refrence. So in this case use B3 as the refrence point. which is a partial number of 48900421 Rev 2. What I want to do is this, use two refrence points.
I want to look up B3 in OOR, and use two points of refrence to gurantee the correct job is refrenced. Those two columns to refrence is in Jobs. The first is Column B which will always equal Dakota Systems, Inc., and the other will reference Column C, but this is where I don't know what to do here, I since C3 in OOR only shows 48900421, it will never find 48900421 Rev 2I thought about using something like this:
=IFERROR(INDEX(Jobs!$E:$E,MATCH(1,INDEX((OOR!$C:$C=$B3)*(Jobs!$C:$C="Dakota Systems, Inc."),1),0)),"")
But for some reason I am getting a blank when I don't think I should be. I'm loosing my sanity this late in the week, can someone help?
https://dl.dropbox.com/u/3327208/Excel/twosearches.xlsx
You don't seem to be referencing the right columns....and also you need a zero in the second INDEX function, not a 1
Try this version in in OOR!I3 copied down, using ISNUMBER(FIND to find your part number within other text:
=IFERROR(INDEX(Jobs!E$3:E$1000,MATCH(1,INDEX(ISNUMBER(FIND(B3,Jobs!C$3:C$1000))*(Jobs!B$3:B$1000="Dakota Systems, Inc."),0),0)),"")
format in required date format
Revised re comment below:
=IFERROR(INDEX(Jobs!E$3:E$1000,MATCH(1,INDEX(ISNUMBER(FIND(B3,Jobs!C$3:C$1000))*(Jobs!B$3:B$1000="Dakota Systems, Inc.")*(Jobs!A$3:A$1000=M3),0),0)),"")

Resources