Excel - How to combine these formulas into one? - excel

I have this worksheet which lists results oldest to newest dates.
I have these three formulas..
=IFERROR(LARGE(IF([#HomeTeam]=[HomeTeam],IF("H"=[FTR],IF([Date]<[#Date],IF([#Season]=[Season],[Date],"")))),1),"NULL")
=IFERROR(LARGE(IF([#HomeTeam]=[AwayTeam],IF("A"=[FTR],IF([Date]<[#Date],IF([#Season]=[Season],[Date],"")))),1),"NULL")
=IF(AND([#[SLWD_H1]]="NULL",[#[SLWD_H2]]="NULL"),"NULL",MAX(Results[#[SLWD_H1]:[SLWD_H2]]))
Basically the first looks for the last time the home team won a game at home.
The second looks for the last time the home team won a game away from home.
And then the third gives me the latest date of the two mentioned above.
I was wondering if there was a way to combine all three into a single column instead of having to have three?
Thankyou in advance.
**EDIT
To make myself a bit clearer! What I want is to combine the above 3 into one formula which will output the result!
So it will find the date in example 1 and find the date in example 2 and then it will output the latest date.

Use the MAX formula to determine the highest date between the home and away dates.
The formula would look like this:
=MAX(Number1,Number2)
The MAX formula will ignore the NULL text values. However if both values are NULL, it will return a zero value. If formatted as a date it will show as 00/01/1900
=MAX(IFERROR(LARGE(IF([#HomeTeam]=[HomeTeam],IF("H"=[FTR],IF([Date]<[#Date],IF([#Season]=[Season],[Date],"")))),1),"NULL"),IFERROR(LARGE(IF([#HomeTeam]=[AwayTeam],IF("A"=[FTR],IF([Date]<[#Date],IF([#Season]=[Season],[Date],"")))),1),"NULL"))

If I understand correctly, would an OR("A"=[FTR],"H"=[FTR]) work? This would work like your first formula except using both "A" and "H" games.
=IFERROR(LARGE(IF([#HomeTeam]=[AwayTeam],IF(OR("A"=[FTR],"H"=[FTR]),IF([Date]<[#Date],IF([#Season]=[Season],[Date],"")))),1),"NULL")
Are these the only two values for [FTR]? If so you could just get rid of that IF statement entirely requiring either H or A:
=IFERROR(LARGE(IF([#HomeTeam]=[AwayTeam],IF([Date]<[#Date],IF([#Season]=[Season],[Date],""))),1),"NULL")

Related

Indexing an answer limited to after today in Excel

I'm trying to put together a company excel sheet to keep track of the tickets we give out to senior sales to take out clients.
I put together a "Soonest Available Ticket" section to easily ID what games are coming up we still have tickets for. However, we don't give out tickets to every game and so I want to have these formulas return dates only of games that have not happened yet. Right now, they simply return the first unclaimed game which are all in the past.
I've tinkered with a few formulas, but I can't figure out how to only command it to look at dates today or later. Any ideas?
Below, in order, are my original Index formula, and then my attempts to only find upcoming games.
=IFERROR(INDEX(CubsDate,MATCH("Avail*",CubsTicketStatus,0),1),"Filled")
=IF(WhiteSoxDate>NOW(),IFERROR(INDEX(WhiteSoxDate,MATCH("Avail*",WhiteSoxTicketStatus,0),1),"Filled"),"Season Ended")
=IF(WhiteSoxDate>NOW(),INDEX(WhiteSoxDate,MATCH("Avail*",WhiteSoxTicketStatus,0),1),"Season Ended")
{=INDEX(WhiteSoxDate,(MATCH("Av*"&"*">TODAY(),WhiteSoxTicketStatus&WhiteSoxDate,0)))}
Assuming that "CubsDate" and "CubsTicketStatus" are named ranges of cells (the former containing dates and the latter the status, either "Avail" or "Filled"), then perhaps this will do what you want:
{=INDEX(CubsDate,MATCH(1,(CubsTicketStatus="Avail")*(CubsDate>TODAY()),0))}
Note that if there is no matching date after the current date, you'll get an #N/A result (which you could easily test for).
Here's a test I ran:
Note that the data here is in rows 25 - 31. Also, you'll need to format the result as a date.
Hope this helps!
Edit: Here's an explanation of how the Match function is being used. (I edited the answer so that future generations will find it more easily than if I added a comment.)
As a reminder (because I'm old and forgetful), the Match function takes three parms: Lookup Value, Lookup Array, and Match Type. So in
MATCH(1,(CubsTicketStatus="Avail")*(CubsDate>TODAY()),0)
we're looking for a value of 1 with a match type of 0 (exact match). That's the easy part. Our Lookup Array, however, is a little more complex. It consists of two tests multiplied by each other. So in each row, it looks at the value in CubsTicketStatus to see if it is "Avail" and it looks at the value in CubsDate to see if it's after today.
Each of those tests results in either TRUE or FALSE but, when you put them in the context of a mathematical calculation, they are 1 and 0. So if they're both TRUE, then you get 1 * 1, but if either (or both) is FALSE, you get zero. The Match function then returns the first row where both are TRUE -- that is, the first row where tickets are "Avail" and the date is after TODAY().

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)))

How do I calculate a Sum based on multiple If's in Excel?

Background is that I'm making a budget spreadsheet. I have different bills due on different days. (ie. bill due on Monday and bill due on the 10th)
I want a function that will place the appropriate amount of money going in/out in column D and the description of why the money is going in/out in column E.
Currently I have two different formulas that I created (probably incorrectly).
Formula for Column E: (Already is in the document and seems to work fine other than that fact that I cant add additional text to the cell)
=IF(DAY(C36)=7," Amy Pay","")&IF(DAY(C36)=22," Amy Pay","")&IF(DAY(C36)=8," Family Bills","")&IF(DAY(C36)=6," Dollar Shave Club","")&IF(DAY(C36)=2," Amy Cap One VISA","")&IF(DAY(C36)=3," Chase VISA","")&IF(DAY(C36)=8," Being Smart","")&IF(DAY(C36)=17," Gym","")&IF(DAY(C36)=11," Netflix","")&IF(DAY(C36)=19," Cap One MC","")&IF(DAY(C36)=29," CenturyLink","")&IF(DAY(C36)=6," Haley Cap One Visa","")&IF(DAY(C36)=10," SRP","")&IF(DAY(C36)=23, "Car Payment","")&IF(DAY(C36)=30, "Rent","")&IF((B36)="Mon"," Monday","")&IF((B36)="Fri"," Friday","")&IF((B36)="Fri"," Haley Pay","")
Formula for Column D: (not in the column yet, as it doesn't work how I want)
=IF(DAY(B40)=7,"1474.22","")&IF(DAY(B40)=22,"1474.22","")&IF(DAY(B40)=8,"-100","")&IF(DAY(B40)=6,"-9","")&IF(DAY(B40)=2,"-100","")&IF(DAY(B40)=3,"-100","")&IF(DAY(B40)=8,"-400","")&IF(DAY(B40)=17,"-20.05","")&IF(DAY(B40)=11,"-8.63","")&IF(DAY(B40)=19,"-450","")&IF(DAY(B40)=29,"-50","")&IF(DAY(B40)=6,"-150","")&IF(DAY(B40)=10,"-200","")&IF(DAY(B40)=23,"-325","")&IF(DAY(B40)=30,"-500","")&IF((A40)="Mon","-125","")&IF((A40)="Fri","-325","")&IF((A40)="Fri","400","")
http://imgur.com/IBINweh
      
The problem is that in column D, rather than providing a sum of the numbers, it lists the numbers in the column.
http://imgur.com/rPDS5h2
      
I had a suggestion to add =SUM( in front of the IF( function, but when I do, #VALUE! is what results in the field. Using this formula: (view image by changing appended text to /CVs0f1v )
=SUM(IF(DAY(B40)=7,"1474.22","")&IF(DAY(B40)=22,"1474.22","")&IF(DAY(B40)=8,"-100","")&IF(DAY(B40)=6,"-9","")&IF(DAY(B40)=2,"-100","")&IF(DAY(B40)=3,"-100","")&IF(DAY(B40)=8,"-400","")&IF(DAY(B40)=17,"-20.05","")&IF(DAY(B40)=11,"-8.63","")&IF(DAY(B40)=19,"-450","")&IF(DAY(B40)=29,"-50","")&IF(DAY(B40)=6,"-150","")&IF(DAY(B40)=10,"-200","")&IF(DAY(B40)=23,"-325","")&IF(DAY(B40)=30,"-500","")&IF((A40)="Mon","-125","")&IF((A40)="Fri","-325","")&IF((A40)="Fri","400",""))
Any ideas on how I can get all the to populate and sum appropriately?
Forgive my Non Excel Guru knowledge - trying to learn. :D
-Amy
If you take all of the options from your first working formula and change the method retrieving them, you will have a much more versatile worksheet that can easily accept new additions and schedule modifications.
    
In a couple of unused columns to the right, pit in the day-of-month and the action that occurs. I'm using columns Y & Z. You have two events occurring on the 6th so I put them together.
In a couple of other unused columns use the day-of-the-week and associated text.; I've used columns V & W. The default for Sunday is 1.
In E36 use this formula,      =TRIM(IFERROR(VLOOKUP(DAY(C36),$Y:$Z, 2, FALSE), "")&" "&IFERROR(VLOOKUP(WEEKDAY(C36),$V:$W, 2, FALSE), "")) 
Fill down as necessary.
If you want the day-of-the-week in column B, use =C36 and use a custom number format of ddd or dddd.
References:
  VLOOKUP function  WEEKDAY function
You are concatenating text strings that look like numbers. You probably want to be adding real numbers:
=SUM(IF(DAY(B40)=7,1474.22,0) + IF(DAY(B40)=22,0) + ...
although, whenever I see a formula as complex as what you have, I would consider looking for a different solution -- Vlookup comes to mind.
In addition, with a VLOOKUP table, you would have seen that you have some conflicts -- e.g: you list the same condition of B40=8 to return two different values; and the same condition of A40 = Fri, to also return two different values.

Converting letters to text and back again (Excel 2013)

For a piece of coursework I have to complete a register of student grades. I am trying to calculate their overall grades by converting their grades from each of the four units into numbers (which I have done using the VLOOKUP function), but I need to then convert the result of the average back into a letter. I have used VLOOKUP and also a long nested IF statement to try and accomplish this, but no matter what I can never get a valid result. This is what I have so far (this is just a link to my image as I am unable to post one).
I have converted the Target grade into a number using the formula:
=VLOOKUP(D3,'Grade Values'!A$2:B$11,2,FALSE)
Then added up the total of the different grades from the four units using this formula:
=SUM(VLOOKUP(F3,'Grade Values'!A$1:B$11,2,FALSE)+
VLOOKUP(Dashboard!G3,'Grade Values'!A$1:B$11,2,FALSE)+
VLOOKUP(Dashboard!H3,'Grade Values'!A$1:B$11,2,FALSE)+
VLOOKUP(Dashboard!I3,'Grade Values'!A$1:B$11,2,FALSE))
And then averaged it out with this: =J3/4
The problem I am facing at the moment is that when converting this number back to a letter using the same table as in the second screenshot I get an N/A result when I use this formula: =VLOOKUP(K3,Dashboard!A1:B10,1,FALSE)
I can't seem to figure out what's going wrong with the formula at the end. If anyone can please help me figure this out I will appreciate it a lot. Thank you :)
Edit: I apologise for the irrelevant tags, as far as I was aware formulas in Excel were written in JavaScript.
Personally, I would convert the letter grade to ASCII character using the function:
CODE(A1)
use the ASCII Reference Chart for the integer value of each Upper Case character. Note: A=65, B=66, etc... Perform your calculations, then you can use the function:
CHAR(A2)
to convert the number back into a character.
Example:
A1="A"
A2="B"
A3="C"
B1="=CHAR(AVERAGE(CODE(A1),CODE(A2),CODE(A3)))"
just copy the column A in the sheet dashboard and paste it in column C in the sheet dashboard... so you have
A B C
A* 7 A*
A 7 A
B 6 B
....
the formula you have to use is
=VLOOKUP(K3,Dashboard!$B$1:$C$10,2,FALSE)
remember that this time u need to match a number... not a letter

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