Active cell is B2. Reference cell is A2, formatted as hh:mm:ss
B2 will display specific text depending on what time is manually inputted in A2. Specifically:
If manually inputted text in B2 is between 12:07:00 - 12:06:00, A1 will display text "Z1".
If manually inputted text in B2 is between 12:05:59 - 12:05:30, A1 will display text "Z2".
If manually inputted text in B2 is between 12:05:29 - 12:05:00, A1 will display text "Z3". etc.
Preference is for an IF function, and not a VLOOKUP. Have tried with a VLOOKUP but I'm obviously doing something wrong:
Undesired result 1 for VLOOKUP attempt:
Undesired result 2 for VLOOKUP attempt:
Thank you!
As a start, I can give you following example, which returns "AAA" in case the time is larger than 12h05.00, and "BBB" in other case:
=IF(B1>=TIME(12;5;0);"AAA";"BBB")
Obviously, you'll need to be able to combine conditions, like:
=AND(B1>=TIME(12;5;0);B1<=TIME(12;6;0))
(which you'll need to embed in your formula)
From here, you have a good start.
In case you still have issues, you can comment this answer.
I know you wanted an if statement however I fixed your vlookup problem for this. You would list the times in ascending order and use the formula =vlookup(a2,$E:$F,2,True). Your column d values are not useful here. This will look up the closest match for A2 that doesn't pass the amount in E.
example
I have a column of dates (daily) and I want an IF statement that will check if the corresponding cell is the 17th of any month.
I'm happy with the syntax of if statements but am unsure how I should be using wildcards here. 'x'below can be any numerical value.
The cell in question looks like - 17/07/2019.
= IF( cell = 17/**/****,x,0)
Excel gets confused and tries to show me how to do maths without a formula.
If you already know that the date is not a text value you can use a simple formula like:
=IF(DAY(A1)=17,”x”,0)
The only issue is that your dates may be genuine Excel dates or text values. With data in A1, in another cell enter:
=IF(ISNUMBER(A1),IF(DAY(A1)=17,"X",0),IF(LEFT(A1,2)="17","X",0))
I want to have a "dynamical" condition in Excel as follows:
in Sheet2.Cell(C2)
If(AND(Sheet1!D2-Sheet1!C2<0;the sum of all cells, in the same row, however before
the current cell which is in this example: Sheet2.Cell(C2)!=0);0;Abs(Sheet1!D2-Sheet1!C2))
I tried with SUM and SUMIF but the problem is within the first cell and after that if I drop the formula the area is still fixed.
Sincethe problem is complicated I give here one example constructed by me which hopefully helps to clarify the problem. In the following pic we see a time series
the series in row 3 is permanently falling. The series in row 2 is from B2 to C2 falling but from C2 to D2 raising and the rest falling. Now In sheet 2 I want to recognize if a time series from sheet1 shows EVEN just one time raising behaviour and if yes from that cell I will put the difference but not Zero. Like in the following pic[]
That is not the most elegant solution but;
I calculated the first column (which is in my example B) as follows:
=IF((Sheet1!C2-Sheet1!B2)<0,0,ABS(Sheet1!C2-Sheet1!B2))
And in C2 I wrote
=IF(AND((Sheet1!D2-Sheet1!C2)<0,SUM($B2:B2)=0),0,ABS(Sheet1!D2-Sheet1!C2))
then I applied this formula to all fields! It works.
Disadvantage: the first column should be calculated before we would be able to apply it to the rest.
I need to write a formula in Excel that returns a numerical value in B1 for a day of the week entered in A1. For example:
A1=Sun so B1=0;
A1=Mon so B1=1;
A1=Tues so B1=2; etc.
I've set up a drop-down in A1 to keep the data consistent. I tried writing a nest IF and OR function in B1, but can't seem to make it work.
Any suggestions?
Please try:
=MATCH(A1,{"Sun","Mon","Tues","Wed","Thu","Fri","Sat"},0)-1
I would setup a lookup table (maybe where you dropdown data is) and use vlookup
=VLOOKUP(A1,Dates!$A$1:$B$3,2)
Type this code into cell B1.
=LOOKUP(A1,{"Sun","Mon","Tues","Wed","Thurs","Fri","Sat";0,1,2,3,4,5,6})
Then you can copy it down the column as needed.
I'm looking for a formula to return one of six possible results based on which date (if any) is the highest out of all dates available that fall within a specific date range.
Consider the following layout:
Cell A1 has a fixed date (this is my lower constraint)
Cell A2 has a fixed date (this is my upper constraint)
Cells G5:K5 may contain dates or they may be blank.
If G5 and H5 both contain dates and both of those dates are between my dates in A1 and A2, then I want the result of my formula to identify which of those two is the most recent (it can show the date itself, the column header, a text string, doesn't matter as long as it is something different for each column)
If any of G5:K5 also contain other dates that fall outside of the window defined by A1 & A2 then those dates should be ignored.
If none of the dates are within the permitted range or all of the cells are blank then it can return a string like "not applicable" or an error that I can rewrite using IFERROR.
My dataset is pretty big (I'll be copying this formula down several hundred rows) so I would prefer to avoid using an {array} formula if possible - too slow. I've been staring at this worksheet long enough for my brain to have turned to mush, so if there is a straightforward approach to reaching my goal it is currently eluding me.
Any assistance greatly appreciated!
Figured it out in the end. It's not pretty, but it works.
This part returns the highest valid date:
MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))
And then by nesting it I can convert the results to a different text string depending on which column contains the "winner".
=IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=G5,G5<>""),"CA",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=H5,H5<>""),"MX",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=I5,I5<>""),"BR",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=J5,J5<>""),"IQS",IF(AND(MAX(IF(AND(G5>=$A$1,G5<=$A$2),G5,0),IF(AND(H5>=$A$1,H5<=$A$2),H5,0),IF(AND(I5>=$A$1,I5<=$A$2),I5,0),IF(AND(J5>=$A$1,J5<=$A$2),J5,0),IF(AND(K5>=$A$1,K5<=$A$2),K5,0))=K5,K5<>""),"Other","Not Applicable")))))
I think I understand now. The following formula will get you the maximum date in the range G5:K5, subject to the condition that it be between the dates in A1 and A2. It will return "not applicable in the event that none of the dates meet the condition.
=IF(COUNTIFS(G5:K5,">="&$A$1,G5:K5,"<="&$A$2)<5,LARGE(G5:K5,1+COUNTIFS(G5:K5,">"&$A$2)),"not applicable")