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))
Related
I'm trying to make a formula that will find the maximum value in a column using the left function, but only for cells which contain a serial date value matching today's serial date value.
Formatting of the data in the column
Based on the example data, the result of the formula should be 12, because today's serial date value is 44755, and the cell with the highest matching serial date value is 12. This is the formula I currently have, which I found in an older post looking for a similar solution.
=AGGREGATE(14,6,--LEFT(Database!$H$1:INDEX(Database!$H:$H,MATCH("ZZZ",Database!$H:$H)),2),1)
It finds the maximum value perfectly, so in the example above it would return 15. But for the life of me, I can't figure out how to only consider cells that have the matching serial date value without breaking the formula.
Please let me know what you think.
Thanks!
This is the way I understood your question:
(in cell B1 is the formula from your link)
This is the formula (cell C1):
=LET(vBase;$A1:INDEX($A:$A;MATCH("ZZZ";A:$A));vLeft;LEFT(vBase;2);vRIGHT;RIGHT(vBase;5);vFiltered;FILTER(vLeft;vRIGHT=TEXT(TODAY();"0");"no such date");AGGREGATE(14;6;--vFiltered;1))
Might need to replace ; with , due to regional settings
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'm trying to count the number of distinct text from a specific date in a data table.
Data Sample with expect result :
I was able to figure out how to count the distinct element from a range I specify, because I can determine the first and last row containing the date.
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
I have tried to modify my formula so that it determines the cell range by itself but without success.
I searched for an answer, using a combination of CELL and MAXIFS, example below, but Excel does not accept the formula.
=CELL("row",MAXIFS(A2:A15,A2:a15,D2))
I've looked at the INDEX formula, but I can't figure out how to do what I want to do. 😑
Any idea what I'm doing wrong, or what I should be doing instead?
Thanks, I appreciate it!
If you have Office 365 and the new Dynamic Arrays, this sort of formula has become ridiculously easy.
This formula in cell E3:
=COUNTA(UNIQUE(FILTER($B$2:$B$15,$A$2:$A$15=D3)))
Copy down.
You can also generate the unique list of dates with this formula in D3, which spills down automatically and does not need to be copied.
=UNIQUE(A2:A15)
It wasn't easy, but by separating each step of the problem, I was able to solve it.
Note that my solution only works because my dates are sorted.
Here's the final formula in the cell "One formula to rule them all":
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2))),INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)))))
Here are my explanations of my process:
Formula if I select the range :
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
Formula to get the first iteration
=ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2)
Formula to get the last iteration
{=ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)}
Create range from two addresses
=INDIRECT(CONCATENATE(F3,":",G3))
Formula giving me the expect result
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(F3,":",G3)),INDIRECT(CONCATENATE(F3,":",G3))))
I need to convert this data dd/mmm - 31.mar (March) to this format 31/03 - dd/mm using excel formula
A bit of googling would have solved your issue here.
Select cell (or range of cells).
Right click with mouse
Format Cells
Custom
Change Type: dd/mmm to dd/mm
=text([CellWithDate],"dd/mm")
is the formula you want, I think.
#Valeria:
Can't be sure I understood your problem and/or the type of solution you're looking for.
I assume you have a date in , say, cell A1 and that cell is showing the date in "dd-mmm" format.
I also assume you want that date to be shown in another cell (different from A1) in "dd/mm" format BUT without previously setting that target cell format to "dd/mm".
In case I'm right, the formula you should put in the target cell shouldo look like:
=DAY(A1) & IF(MONTH(A1)<10;"/0";"/") & MONTH((A1))
This way, if cell A1 holds "31-aug", you're getting "31/08" wherever you put that formula.
The value Excel actually stores in the cell is just its date+time serial number (whatever you're seeing is a very different question). DAY() and MONTH() do work on that value to generate day of the month and month of the year after that serial number.
Hope this helps.
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.