How do i sum up a range of amounts after checking through the month and year?
As you can see in the image, my code currently sums up all amounts by checking only on the month. This is incorrect as it should check the year as well before auto summing itself into the respective months and year.
Here is the Excel Cell code:
Cell C36="$"&SUMIF(B17:B23,"*."&TEXT(B30,"mm")&".*",E17:E23)-SUMIF(B17:B23,"*."&TEXT(B30,"mm")&".*",G17:G23)
I tried modifying the code to add in a "yy" as shown below, but it didnt work out. In fact the 2017 amount of $555 reflected in 2018 instead.
="$"&SUMIF(B17:B23,"*."&TEXT(B30,"mm")&"."&TEXT(B30,"yy")&"",E17:E23)-SUMIF(B17:B23,"*."&TEXT(B30,"mm")&".*",G17:G23)
What do I need to change?
BTW, Cells B30 and B36 are Custom formatted to "mmm-yy" while Cells B17 and B18 is Text.
managed to solve my own code.
Apparently its just a change in the parameters.
Cell C36="$"&SUMIF(B17:B23,"*."&TEXT(B30,"mm.yy")&"*",E17:E23)-SUMIF(B17:B23,"*."&TEXT(B30,"mm.yy")&"*",G17:G23)
Here is an alternative. SUMPRODUCT allows you to use RIGHT function to do the comparison for mm.yy.
="$" & SUMPRODUCT((--(RIGHT(B17:B23,5)=TEXT(B36,"mm.yy")))*E17:E23)-SUMPRODUCT((--(RIGHT(B17:B23,5)=TEXT(B36,"mm.yy")))*G17:G23)
Related
Im exploring how feasible it is to extract data from cells that consist of text. ultimately. I will apply conditional formatting rules based on the date relative to today, but right now I just need to be able to extract them.
So far I have achieved the following:
To achieve this I've used the formula found online =IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),""). The issue is that if a cell contains only a date, the Length is subtracted from itself and nothing is returned. I have tried modifying the above equation but keep running into errors.
Hoping someone may be able to help me out modify this formula. Alternatively, if anyone knows how dates can be extracted used just excel formulas that would be great.
The issue is that without the other text it is a true date and a true date is a double and has no - in it.
The simple fix is to wrap change the"" return from the IFERROR to B2:
=IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),B2)
If that is not sufficient you can do an IF to test if date:
=IF(ISNUMBER(B2),B2,IFERROR(DATEVALUE(LEFT(RIGHT(B2,(LEN(B2)-(FIND("-",B2)-3))),11)),""))
This is a solution I came up with with appears to work for almost Any Date format provided the date is at the top of the cell. Note this was done for dates in cell H6 of my workbook.
The formula below can be entered below to extract the date from this cell amongst text.
=TEXT(IFERROR(LEFT(H6,SEARCH(CHAR(10),H6,1)-1),H6),"dd-mmm-yyyy")
This formula checks if the date is within 3 years and returns a true of false value. This can be used to conditionally Format Cells if the date once extracted is out of date.
=IF(ISBLANK(H6),FALSE,IFERROR(IF(DATEVALUE(TEXT(IFERROR(LEFT(H6,SEARCH(CHAR(10), H6, 1)-1),H6),"dd-mmm-yyyy"))<=TODAY()-(365*3),TRUE,FALSE),TRUE))
Works really well for me!
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 have collision data in column F I have the years from 2004-2015, I have named the range ATT_YEAR and In column G I have the dates and the range is named ATT_DATE. What I am trying to do is to either use COUNTIFS or SUMPRODUCT to determine the number of collisions by month of the year, if I select the year as say 2013, I want to show the number of collisions by month.
I was trying the following the formula:
=COUNTIFS(ATT_YEAR,"2013",ATT_DATE,MONTH=1)
but not getting very far with one.
Or when I tried using sumproduct formula:
=SUMPRODUCT(--(ATT_YEAR,"2013"),MONTH(ATT_DATE)=1)
I would be grateful for any assist on either of these.
I think you are using the formula wrong:
=SUMIFS(COLLISION,ATT_YEAR,2013,ATT_MONTH,1)
This will count all collisions in the named-range "COLLISION" only if 2013 is matched in the named-range "ATT_YEAR" and 1 (i.e. January) is matched in the named-range "ATT_MONTH".
edit
Needs updating, wrong assumptions.
You cannot use MONTH, which is the function you need, inside COUNTIFS. Instead, create another column, with the formula MONTH(B2), assuming column B has the date values, and use it as a new ATT_MONTH range:
=COUNTIFS(ATT_YEAR,2004,ATT_MONTH,6)
I’ve been struggling to try and figure this one out, it to do with conditional formation in Excel. I want to find a way to highlight the next payment schedule based on the current date. So if today was 10 Feb, the next payment schedule would be 15th Feb and is therefore highlighted. If today was the 16th Feb, A6 and B6 would be highlighted
Can any one help me with the formula for this, I’m assuming its conditional formatting with a formula. but the formula stumps me. this formula would need to be applied to a large range of dates (600 dates)
Simply try this formula:
=COUNTIFS($A$2:$A$9,"<="&$A2,$A$2:$A$9,">"&TODAY())=1
if you want to show also a day which is the actual day then simply add the = to the today part:
=COUNTIFS($A$2:$A$9,"<="&$A2,$A$2:$A$9,">="&TODAY())=1
but make sure to not miss any $ (or do to much of them) ;)
alternatively you also could use the short formula (which may be slower for bigger tables:
=$A2=MIN(IF($A$2:$A$9>TODAY(),$A$2:$A$9))
$A$2:$A$9>=TODAY() will include the actual day
I am using the following formula to change a cell's conditional formatting depending on how close to today's date the value is:
Cell Value is Between =TODAY()-5 and =TODAY()+5
This is working but I want to exclude weekends.
So if the date in the cell is 03/10/14 and today's date is 26/09/14 I would like to be able for my formula to identify that there are only 6 days and not 8 days which would include the weekend.
Please can someone tell me how what formula I would need to use to do this? I have tried to use the WORKDAY() function but can not seem to get it to work?
Assuming your dates are in ColumnA, please try this CF formula rule:
=AND(A1<=WORKDAY(TODAY(),5),A1>=WORKDAY(TODAY(),-5))