So I am trying to come up with a ranking system that will start at 1, and increment for every different client we have, and reseting each month.
Heres what I have:
=SUMPRODUCT(--([Client]=[#[Client]]), --([Receive Date]> [#[Receive Date]]) )+1
When this is entered, a #VALUE is returned to the cell, however, when I use
=SUMPRODUCT(--([Client]=[#[Client]]), --([Sales Rep]> [#[Sales Rep]]) )+1
Or another column (that is not a date) everything seems to work out fine. Although, obviously, that makes the ranking on a rep by rep and client basis rather than month.
Any suggestions as to why the date column isn't working and how to fix it?
Edit: Oops, forgot to include this, since I want to reset the ranking every month, I have another column that concatenates the month and year, so a Receive Date of 3/10/2014 would become "3 2014".
Then I use the:
=SUMPRODUCT(--([Client]=[#[Client]]), --([Concat Date]> [#[Concat Date]]) )+1
And thats where things get squirrelly.
Edit 2:
Alright, so I think I figured out the formula, which I constructed in this dummy workbook. Everything works perfectly here! But when I copy and paste it into the actual workbook I'm using, the #VALUE error pops up. I've checked the formatting of each corresponding column from my test file to my real one. Has me totally stumped, thoughts?
Now that you added in the edit of Concat Date, it makes sense... My belief is that you probably are creating that field as text rather than a date and so your comparison operatir will no longer work.
So, suppose your sheet had your dates in column A beginning in A2 - You could create the Concat Date field using the following formula:
=DATE(YEAR(A2),MONTH(A2),1)
OR
=EOMONTH(A2,-1)+1
In effect, it will give you the first day of the month for any date BUT it will still be a date, so your comparison operator will still work.
PS - You can still use cell formatting to make it look like `3 20141 if you really wanted to, but the most important part is that it is a date value so you can use it for comparisons!!
Hope this does the trick!!
Related
How do I separate date and time from this 2006-09-02T01:07:59.100 I’ve tried =int(A2) but it gives a value error. Please help.
in the column for Date put this formula: =left(A2,10), for the time: =right(A2,12)
Not sure what your purpose is. Display date and time separately or actually have two different values in different cells.
Excel does not play nice with "T" in the middle of the timestamp. You must remove "T" using a string function. Once you have done that your value will format nicely as a date. INT works for the date part, MOD works for time, format cells accordingly.
If display is the only requirement, put the same value in both cells and use cell formatting -- one for Date, one for Time.
I'm having a strange issue here with Excel. I'm working with a custom datetime format in one column...
9/1/2017 12:02:01 AM
This is cell C2. However, using LEN on this cell gives me this...
1900-01-15 00:00:00
I've tried changing the format to General, or Text, and messing around with some custom datetimes, but it doesn't help. I will get the same answer. My goal here is to use this as an exercise and trim the date and time, putting them in separate columns. This spreadsheet was originally created using Google Sheets, not sure if that might explain it?
UPDATE: Ok, so about 1 minute after posting this I think I figured it out? I used LEN in the column to the left of column C, so B. I had been using column D. For some reason, column B returned the numerical value. Obviously I'm very new to Excel. I didn't think column placement mattered in this case. Why does it?
That's because you have formatted the result to be shown as a date.
Remember, dates are simply really large numbers. So, what has happened here is that you get the correct result from LEN(), but then you have formatted this result to be interpreted as a date.
The date seems to indicate the result was 15. In dates, this is 15 full days from 1900 January 1st.
So, you just have to change the format of that cell from a date, to be a number :)
I have a sheet that updates from a query, attached example. The query is formatted so that the dates are from latest to oldest. I need to pull data from the rows based on the last entry of a specific item that is made each month. There are multiple entries but I only care about the counts for 'Cross1'. So I need the last entry for each of these every January, then February, and so on. This is updated each month. I was conchatenating the date and the description columns for my VLOOKUP.
Originally, I had no problem using a VLOOKUP that just found the entry based on the last day of the prior month, as there was always an entry on the final day of the month. However, the users have now changed the data so that it may not update all the way through the month due to breaks, meetings, vacations, etc. So now my formulas do not work for those months and they will be random. You can see this in the attachment, which I pulled from halfway through December. You can see that Cross1 disappears after the 20th. It has entries for the 21st but the counts are empty. I need to pull the last entry for each month of Cross1 that has the counts filled in. In this case, 12/20, NOT 12/21.
I then tried alternatives such as the LOOKUP function which seemed to be what I needed. However, the function assumes that the data is sorted in the opposite order of my sheet. So, it works and finds what I need, but in the wrong direction (finds the FIRST entry instead). I have asked, and cannot change the query data. So that option is out.
This formula works if the data is sorted with the last date at the top: =LOOKUP(2,1/(c$2:c5995=D4786),a$2:a5995). However, I need to also have it verify that it is the last entry AND there are counts present. In other words, 12/21 would NOT be the entry I want. I would want 12/20 in this example. Thanks to #ronrosenfeld for helping me flesh out my question.
So I am hoping someone has a suggestion. I can go the VBA route but I was thinking there might be something simpler?
Here's one way using array formulas:
I'm making a summary of a list of tasks, and the corresponding dates (start date, first answer date, ...).
It looks more or less like the following:
Title Start date First answer
Task1 29/06/2018 02/07/2018
Task2 09/05/2018
Task3 13/06/2018 14/06/2018
I would like to calculate the average time, needed for the first answer to be given. In case no first answer is given yet, this entry needs to be ignored in the calculation of the average.
In order to be able to understand the formulas better, I've decided to use names for the headers, like:
Name "Header_Title" has value "Title"
Name "Header_Start_Date" has value "Start Date"
Name "Header_First_Answer" has value "First answer"
Also, the number of entries, defined as COUNTA(OFFSET(Header_Title;1;0):A1048576) has a name: Total_Count.
Next to that, I've created names for the ranges of the column values:
"All_Start_Dates" is defined as =OFFSET(Header_Start_Date;1;0):OFFSET(Header_Start_Date;Total_Count;0)
"All_First_Answered" is defined as =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0)
Explanation : take the first entry under the header (column title) and go to the row, corresponding to the last task.
This makes it very easy to write a formula for calculating the average difference between those date columns:
{=AVERAGE(All_First_Answered_Dates-All_Start_Dates)}
// mind the {} for showing this is an array formula
Now the problem is: how to use the AverageIf worksheet function in order not to take into account the cases where First answer is not filled in?
I already tried using ">0" and ">"&0, but this does not work, the formulas are said not to be valid:
{=AVERAGEIF(All_First_Answered_Dates-All_Start_Dates;">0")}
{=AVERAGEIF(All_First_Answered_Dates-All_Start_Dates;">"&0)}
Does anybody have an idea?
Thanks in advance
P.s.1. As you can see, I'm using cell range A1048576 as the last entry of column A, does anybody know a more elegant way to describe this?
P.s.2. One extra thing, which would make my life easier, is the possibility to see which cells have a name (I was thinking about conditional formatting, but I didn't find the way to do this). Does anybody know if there is a way to highlight individual cells, linked to a name?
So my suggested answer would be
=AVERAGEIF(All_First_Answered,">0")-AVERAGEIF(All_First_Answered,">0",All_Start_Dates)
I'm assuming here that all start dates are present but first answered dates may be missing: you could easily add an extra condition for start date if you used AVERAGEIFS. Both parts of the formula include the same conditions so they are working on the same rows.
The intermediate columns above are just included by way of explanation.
Try an array formula.
If you're not familiar with array formulas, the significant difference is you press and hold Ctrl+Shift then hit Enter instead of just pressing Enter. You will see the formula preceded and followed by curly brackets. Do not type those. Those will appear automatically.
=AVERAGE(IF(INDIRECT("C14:C"&LOOKUP(2,1/(A:A<>""),ROW(A:A)))=0,"",INDIRECT("C14:C"&LOOKUP(2,1/(A:A<>""),ROW(A:A)))-INDIRECT("B14:B"&LOOKUP(2,1/(A:A<>""),ROW(A:A)))))
For my Pilots logbook I am trying to be able to make a easy search where you can enter certain criteria and get the amount of landings and time in flight.
For example you could enter the departing airport and it would give you the amount of takeoffs from that airport.
So far I have been able to get the results using the COUNTIFSfunction.
Trying to add a field, where you can enter a year and it would only count the occurrences in that year is giving me a hard time!
The date is in the following format: dd.mm.yyyy. The year to search for would be entered in a cell (yyyy).
Just adding it to the COUNTIFSobviously doesn't work. I know I can get the year out of the date using the YEARfunction, yet I can't figure out a way of including this into the COUNTIF.
Any Ideas?
CODE:
=COUNTIFS(Logbook!F3:F2000,IF(ISBLANK(B30),"*",B30),Logbook!C3:C2000,IF(ISBLANK(C30),"*",C30),Logbook!K3:K2000,IF(ISBLANK(D30),"*",D30),Logbook!L3:L2000,IF(ISBLANK(E30),"*",E30),Logbook!G3:G2000,IF(ISBLANK(F30),"*",F30),Logbook!B2:B2000,B30)
Where B30 is the cell with the year, and B2:B2000 being the cells with the dates.
I also tried to compare by the text (somewhat like RIGHT(Logbook!B2:B2000,4)=B30) but it doesn't do anything but returning a #VALUE error.
Seems like a really good case for PivotTables and slicers... You could even avoid the RIGHT() formula if you format the dates; then you could use the built-in group feature of PivotTables.