Reverse Index/Match -or- jumping back 1 cell in Index/Match - excel

This started as a just-for-fun formula in a work spreadsheet, but I couldn't figure it out... Simplified (hopefully), I have a row with months (Jan-Dec) and a row below with dollar values. For this month (May) I am adding a dollar value. The preceding months have dollar values entered in them already. My formula needs to look across the $values row and return the month corresponding to the last cell with an value in it.
Right now Jan-May have $values. I want it to stop at the blank $value for June, back up one cell and return the month-cell = May.
I have been playing with different INDEX/MATCH/LEN but haven't landed on anything yet. The only thing I thought of that would work is nested IF statements moving in reverse (Dec -> Jan) looking for the first cell greater than 0. But I'm using an old version and max out at 7 IFs.

I was looking for something and stumbled on your question. I hope it'll still be somewhat useful!
You probably want:
=INDEX(A1:L1,1,COUNTA(A2:L2))
Where A1:L1 contains your months from January to December and A2:L2 contains the values in dollars. I'm assuming that the values are blank for June through December.

Related

COUNTIFS statement, =COUNTIFS(V60:V91, ">="&0,V60:V91,"<="&30)

I'm attempting a COUNTIFS statement,
=COUNTIFS(V60:V91, ">="&0,V60:V91,"<="&30).
I believe I'm making syntactical error, but I can't finding it. Do you know what I'm doing wrong?
There is nothing wrong with your syntax. You have text-that-look-like-numbers in column V.
Note the right-alignment of the numbers in column V. These are true numbers and are counted by your formula in A1. Note the left-alignment of the text-that-look-like-numbers in column W. They are not counted by the same formula in B1.
Use Data, Text to Columns, Fixed Width, Finish on your column V to turn them into right-aligned true numbers.
Based on the comments in your question, you can try this if you are trying to count dates where the day of the month is Greater than or equal to zero (which would be all days), and the days that are less than or equal to 30...so all days except the 31st. If this is wrong interpretation, let us know. The following formula is based on your dates being stored as numbers and formatted to display as a date and not a date stored as text.
=sumproduct((day(V60:V91)>=1)*(day(V60:V91)<=30))

Counting Number of Months between Two Dates in Excel

So I am attempting to simply count the number of months bewtween an earlier date and today, which will be in the B:B column; once the number of months have been counted, the result is then multiplied by 28, then added back to the original date. Note the requirement: Result >= Today, so basically if the result is less than today it needs to add another 28 days. The current formula I made only works if the dates are in the current year (and I am not 100% sure if this formula works, it appears to so far though.)
Here is my defunct formula, but maybe someone can get a general idea from my above comments and the below formula of what I am attempting to achieve here:
=IF(B89="","",IF(I89="X","LEG",IFERROR(IF((MONTH(TODAY()-B89)*28)+B89<TODAY(),(MONTH(TODAY()-B89)*28)+B89+28,(MONTH(TODAY()-B89)*28)+B89),"Future")))
Thank you in advance for your assistance!
Note: I just want to point out that the reference to I89 is insignificant in the above. I just didn't want to remove it in case I deleted the wrong parenthesis or some other typo, so I decided to leave in there. So basically you would not need to necessarily worry about the first two "IF" statements, nor the IFERROR, unless you just wanted to!
2ND EDIT: Okay I decided to strip down formula, original post's formula is above, the stripped version below:
IF((MONTH(TODAY()-B89)*28)+B89<TODAY(),(MONTH(TODAY()-B89)*28)+B89+28,(MONTH(TODAY()-B89)*28)+B89)
You should not use MONTH() for this purpose as this will lead to wrong results in some cases, and certainly when the B89 date is in another year.
Instead see how many days you are past the last multiple of 28 days since B89, and go back to that date (by subtracting), and then add another 28 to it:
=TODAY() + 28 - MOD((TODAY()-B89), 28)
The earliest date this can give is the date of tomorrow. If today should be an acceptable outcome of the formula, then replace TODAY() with TODAY()-1, which results in this formula:
=TODAY() + 27 - MOD((TODAY()-1-B89), 28)
How about something like this:
=IF(B89="","",IF(I89="X","LEG",IF(IF(B89<=TODAY(),B89+28*IF(AND(B89<TODAY(),TEXT(B89,"mmyy")=TEXT(TODAY(),"mmyy")),"1",(TEXT(TODAY(),"yy")*12+MONTH(TODAY()))-(TEXT(B89,"yy")*12+MONTH(B89))),"Future")<TODAY(),TODAY(),IF(B89<=TODAY(),B89+28*IF(AND(B89<TODAY(),TEXT(B89,"mmyy")=TEXT(TODAY(),"mmyy")),"1",(TEXT(TODAY(),"yy")*12+MONTH(TODAY()))-(TEXT(B89,"yy")*12+MONTH(B89)))))))
Got a little long now, but you have a lot of criteria :)

Excel Match function with concatenated value

I am somewhat new to writing large, complicated formulas with excel. I took over a report from someone about 7 months ago and it seems that every week I find issues with what was written with his formulas.
This week I am having issues with a match formula. We have a report we run for a big hardware store and they report based on weeks. This last week was 201501 (2015, week 1.) Last week was 201452 (2014, week 52.)
To look at 4 week sales averages, my predecessor setup 4 numbers that would change every week based on the week you type in one of the column headings. So, when I type 201452,
#1 is 201449
#2 is 201450
#3 is 201451
#4 is 201452
He feeds those into a match function.
I found this week that 201501 does not correctly display the weeks. I got
Results Formula Used
201501 =D1 (The cell where you type the Store's week)
201500 =IF(M1=201301,201252,IF(M1=201401,201352,M1-1))
201499 =IF(L1=201301,201252,IF(L1=201401,201352,L1-1))
201498 =IF(K1=201301,201252,IF(K1=201401,201352,K1-1))
I changed those formulas
Results New Formula
201501 =D1
201452 =IF(RIGHT(M1,2) = "01",(LEFT(M1,4) - 1)&"52",M1-1)
201451 =IF(RIGHT(L1,2) = "01",(LEFT(L1,4) - 1)&"52",L1-1)
201450 =IF(RIGHT(K1,2) = "01",(LEFT(K1,4) - 1)&"52",K1-1)
However, the match formulas he has setup throughout the workbook have not been fixed. They are still displaying "#N/A." One such formula is
=INDEX(N5:DZ5,1,MATCH(Data!$L$1,$N$1:$ED$1,0))
This formula basically looks at the column headers, and if it sees that the column header matches the week I've typed, will display the value within that range.
Basically, any formula that's being fed the 201452 value is returning "#N/A". The other numbers miraculously display data.
I've already tried converting all of my data in the affected rows to "General" format type. I've tried checking to see if I have spaces before or after in all of my formulas and column headers, but am still having no luck.
Any ideas?
After trying and trying and trying, I found that Excel does not like the concatenation. Trim does not help, Text does not help, Concatenate of course did not work.
I ended up realizing I could simply write
=IF(RIGHT(M1,2) = "01",M1-49,M1-1)
This makes it so that in the instance where the number to the right of it is the first week, subtract 49 days and produce 52 instead of 00.
I'm guessing here, but it could be that your formulas are presenting the Year/Week combo as a number, where the Match formula is looking for text (for Excel's purpose, it doesn't recognize them as the same).
You can get around this, by wrapping your formulas above with the text formula
So you'd have the following:
Results New Formula
201501 =TEXT(D1,"0")
201452 =TEXT(IF(RIGHT(M1,2) = "01",(LEFT(M1,4) - 1)&"52",M1-1),"0")
201451 =TEXT(IF(RIGHT(L1,2) = "01",(LEFT(L1,4) - 1)&"52",L1-1),"0")
201450 =TEXT(IF(RIGHT(K1,2) = "01",(LEFT(K1,4) - 1)&"52",K1-1),"0")

Excel Finding Value Based On Criteria

i have multiple columns in my excel spreadsheet (DOLLAR, Date, Year), i am trying to get the values in column DOLLAR, if the DATE is greater than 01 Jan 2014, and the YEAR is 2014.
I tried sumproduct, countifs, if, match and even combinations of them but i cant seem to get the value of DOLLAR based on the criteria. how would i go about doing this? i am still a bit new to this so i don't quite know all the functions yet.
i have something like this right now, also all the DOLLAR value that meets the criteria will all be summed up.
=IF('CDT DWGS-2014'!F:F=2014,IF('CDT DWGS-2014'!Q:Q>DATEVALUE("01-Jan-2014"),"GET DOLLAR VALUE",0),0)
Thank you
Ok, given your extra comments, I also tried to make it a bit more robust for you, so suppose, in your sheet you had:
A1 = Start Date
B1 = End Date
And in your CDT DWGS-2014 sheet, the Dollar amounts were in column A and the dates were in column B, You could use the following formula:
=SUMIFS('CDT DWGS-2014'!A:A,'CDT DWGS-2014'!B:B,">="&A1,'CDT DWGS-2014'!B:B,"<="&B1)
This could be made simpler, but this should do the trick.
Hope this helps!!
Use this formula. Column A, B and C are for DOLLAR, Date and Year respectively.
=SUMPRODUCT(A2:A11,--(B2:B11>DATE(2014,1,1)),--(C2:C11=2014))

Tell the difference between three months

I can't use a pivot table for this purpose, because this calculation takes place in a huge nested if formula.
Column A has unit
Column B has start date
Column C has end date
Column D:F has data.
Column E... is an attempt to bridge that data, so I can compare July to August.
EDITING QUESTION: I might as well throw it out here since everyone's doing it from scratch.
Okay, in this first picture, there's two dates, a start measurement, and a end measurement. I take end - start. Easy enough.
But then there's exceptions. Sometimes D:F
http://i.imgur.com/z9KhdmC.png
But my data isn't consistent. D:F may be full of zeroes. Sometimes July data is in August, but according to the bridge, that's not the case. I don't think July data will be past August 1st.
To explain that, this new picture is here.
http://i.imgur.com/QcR55s8.png
This is my current formula that I'm trying to figure out.
=IF(AND(B2>=DATE(2013,7,1),B2<=DATE(2013,8,1)),IF(G2<>0,IF(-need.to.prevent.duplicates.here-,F2-D2,0),V2),IF(AND(C2>=DATE(2013,7,1),C2<=DATE(2013,7,31)),IF(B2=DATE(2013,8,1),F2-E2,F2-D2),0))
Using the provided picture, try this formula in cell I32 (because that's where January should begin) and copied over and down:
=IF(TEXT($B32,"mmmm")=I$31,IF(TEXT($C32,"mmmm")=I$31,$G32,$E32-$D32),IF(TEXT($C32,"mmmm")=I$31,$F32-$E32,0))
Alternate (shortened) version to write the same thing:
=(TEXT($B32,"mmmm")=I$31)*($E32-$D32)+(TEXT($C32,"mmmm")=I$31)*($F32-$E32)
[EDIT]: I am including an example workbook here
You have not mentioned what you would like if the months are not both August, so in the following formula (in Row1 and copied down to suit) that scenario results in FALSE:
=IF(AND(MONTH(B1)=8,MONTH(C1)=8),IF(ISBLANK(E1),"OTHER",E1))
However when both are August this should meet your requirements, subject to "OTHER" being a place holder for you alternative formula.
Edit:
I think the above meets "I'd like a formula where if B and C has August. If so, please look for data in E. If data is not in E, do another formula." but if you want to test the presence of E data across all instances of a 'unit` then this:
=IF(AND(MONTH(B6)=8,MONTH(C6)=8),IF(COUNTIFS(A:A,A6,E:E,"<>"&""),"OTHER",E6))
I think I found my solution. My end result is this.
=IF(AND(B2>=DATE(2013,7,1),B2<=DATE(2013,8,1)),IF(G2<>0,IF(E2<>"",E2-D2,IF(P2=G2,0,F2-D2)),V2),IF(AND(C2>=DATE(2013,7,1),C2<=DATE(2013,7,31)),IF(N2>G2,V2-N2,G2-N2),0))
What I did was compare August to G2 (the total) to eliminate the duplicates. If August completely resembled it, then the formula would turn July to 0.
I'm also worked a little bit on the June data side.

Resources