Formula to return text answer from a date cell that falls within a certain date range
I have a cell, lets say B2 which has a date eg/ 21JUN14. I want to return which season this falls into eg "low", "shoulder", "peak" etc from 5 specified date ranges. thanks.
HI KJ,
Here's the syntax for VLOOKUP, taken from the Numbers Help files:
VLOOKUP(search-for,search-range,return-column,close-match)
Your assumption regarding the 2 is correct.
The other key value is Wayne's omission of the fourth argument, "close-match". When omitted, VLOOKUP will look for an exact match, but will accept a close match, defined as 'the largest value less than (or equal to) search-value.
close-match is the reason the table needs to include only the first date of each season, sometimes referred to as the 'threshold value'. Any date 'larger' than that, but less than the next season's starting date will be accepted as being in that particular season.
Note that the searched for dates include the year. The Seasons table will need to be updated regulrly. If you know the starting dates for more than one year, all can be entered as soon as they are known. The table will handle as many dates as are currently known (within a limit that's in the tens of thousands).
Regards,
Barry
Similar Messages
-
Returning results that fall within the current financial year
Hi Everyone,
I am using MSSQL Server 2008R2 and I am interested in returning rows from a 'financial' table that fall within the current year (each row contains a 'Entered Date'). I am located in Australia so my financial year consists of all entries between the date
01/07/xx to the 30/06/yy.
Can anybody suggest some code, perhaps using the datediff() function, or other functions as required to achieve what I need?
Kind Regards,
DavidHi,
Try the Below Script.Hope it works
DECLARE @StartOfFinancialYear
DATETIME
-- This gets 1st April for the current year
SET @StartOfFinancialYear
= CAST(YEAR(GETDATE())
AS VARCHAR)
+ '0701'
SELECT
FROM
<YourTable>
WHERE DateField
>= @StartOfFinancialYear
AND DateField <
DATEADD(yy, 1, @StartOfFinancialYear)
-- less than 1st July NEXT year
Regards, PS -
Is there a way to automatically add text to video; the text gleaned from order data?
is there a way to automatically add text to video; the text gleaned from order data?
What is "order data"?
-
How do I retrieve text messages from a iPhone 4S that doesn't work anymore?
How do I retrieve text messages from a iPhone 4S that doesn't work anymore?
If the phone isn't working, you can't. If you have a backup on your computer, you may be able to extract them from the backup using 3rd party software such as iPhone Backup Extractor (see http://www.iphonebackupextractor.com).
-
I am getting text messages from a "textfree" number that cannot be identified
I am getting text messages from a "textfree" number that cannot be identified. The text messages are threatening and I am trying to match the unknown number to a person. How can I do that?
Hello uncl@home,
Thanks for reaching out to us for assistance with unwanted texts on your device. After all, we're always here to help when you need us. I wanted to touch bases with you to see if the issue has been resolved. Just curious, are you getting unwanted texts from a 10-digit number? If so then you can have the texts blocked at www.vzw.com/spamcontrols. For all other unwanted texts, forwarding them to 7726 is the method to have them addressed. Let me know, just in case more options are needed.
Thank you...
ArnettH_VZW
Follow us on Twitter @VZWSupport -
Function to list the month from a date range?
I would like to know what the function is that would take a look at a date range, and extract the month name
Here is how I would like it to come out:Hello
The following sample tables are along your original scheme using month name to filter the data.
2014 (excerpt)
A1 month
A2 =MONTHNAME(MONTH(B2))
A3 =MONTHNAME(MONTH(B3))
A4 =MONTHNAME(MONTH(B4))
B1 date
B2 2013-01-15
B3 2013-01-20
B4 2013-01-27
C1 category
C2 A
C3 B
C4 C
D1 amount
D2 100
D3 50
D4 20
January
A1 category
A2 A
A3 B
A4 C
A5 D
A6 E
A7 F
A8 G
A9 H
B1 totals
B2 =SUMIFS(2014::D,2014::A,C$1,2014::C,A2)
B3 =SUMIFS(2014::D,2014::A,C$1,2014::C,A3)
B4 =SUMIFS(2014::D,2014::A,C$1,2014::C,A4)
B5 =SUMIFS(2014::D,2014::A,C$1,2014::C,A5)
B6 =SUMIFS(2014::D,2014::A,C$1,2014::C,A6)
B7 =SUMIFS(2014::D,2014::A,C$1,2014::C,A7)
B8 =SUMIFS(2014::D,2014::A,C$1,2014::C,A8)
B9 =SUMIFS(2014::D,2014::A,C$1,2014::C,A9)
C1 January
C2
C3
C4
C5
C6
C7
C8
C9
Notes.
Formula in January::B2 can be filled down across B2:B9.
The target month name is defined in January::C1.
February table is the same as January table except for the value in C1.
And the following sample tables are using date per se instead of month name to filter the data. In this scheme, you don't need month column in source table but the retrieving formulae in destination table become more complex.
2014 (excerpt)
A1 date
A2 2013-01-15
A3 2013-01-20
A4 2013-01-27
B1 category
B2 A
B3 B
B4 C
C1 amount
C2 100
C3 50
C4 20
January
A1 category
A2 A
A3 B
A4 C
A5 D
A6 E
A7 F
A8 G
A9 H
B1 totals
B2 =SUMIFS(2014::C,2014::B,A2,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
B3 =SUMIFS(2014::C,2014::B,A3,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
B4 =SUMIFS(2014::C,2014::B,A4,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
B5 =SUMIFS(2014::C,2014::B,A5,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
B6 =SUMIFS(2014::C,2014::B,A6,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
B7 =SUMIFS(2014::C,2014::B,A7,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
B8 =SUMIFS(2014::C,2014::B,A8,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
B9 =SUMIFS(2014::C,2014::B,A9,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
C1 2013-01-01
C2
C3
C4
C5
C6
C7
C8
C9
Notes.
Formula in January::B2 can be filled down across January::B2:B9.
The target month is defined in January::C1, which can be any date in target month, e.g., 2013-01-01, 2013-01-20, etc. The formulae in B will retrieve data with date in range: 2013-01-01 <= [date] <= 2013-01-31.
February table is the same as January table except for the value in C1.
Tables are built in Numbers v2.
Hope this may help,
H
EDIT: Replaced the last table with the correct one. (Formulae in B are correct) -
Calculating fractions of hours from time date range
Hello friends,
I'm using sql server 2008 r2 and I have a table called attendance with the following fields
attendance_no int
attendance_date date
attendance_timein time(7)
attendance_timeout time(7)
emp_id int
and another table called employee with the following fields
emp_id int
emp_name varchar(50)
emp_tel varchar(50)
I need to calculate the total minutes worked as well as total hours worked for each employee with in a specified date range and I created the below query which working fine but it is not calculating the fractions of hours, I mean when an employee works
for example 7 and half hours, its showing just 7 hours instead of 7.5 hours.
SELECT a.attendance_date As 'Date',e.emp_id As 'ID',e.emp_name As 'Name',e.emp_tel As 'Telephone',left(a.attendance_timein,8)[Time in],left(a.attendance_timeout,8)[Time out],
+ CAST(DATEDIFF(second, attendance_timein, attendance_timeout) / 60 AS NVARCHAR(50)) As 'Total minutes',
CAST(DATEDIFF(second,attendance_timein,attendance_timeout) / 60 /60 % 60 AS NVARCHAR(50)) As 'Total hours'
from attendance a join employee e on e.emp_id=a.emp_id and a.attendance_date between '2014-11-06' and '2014-11-08' and e.emp_tel='65098009'
I would appreciate any help about this.
Thanks in advance
MohamoudIf I understand correctly, according to
Mohamoud's data sample, there is already Total minutes in the input (the above
table Mohamoud posted)
and all he need is a simple convert to decimal and the divided by 60.
select [Total minutes] / 60.c
Mohamoud,
is that correct?
The result show that you might need some rounding. for example 31/60 is 0.516666 while you show us 0.5
Please clarify if you need rounding and how many characters after the dot you need (this can be done using declaring decimal(x,y), converting, or multipla and using floor function, etc')
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
Date deviates from Due Date range??
Hi All,
When i'm trying to add a back dated A/R Invoice, I'm getting an error message that the date deviates from the due date range. I have selected the appropriate posting period for this and also have checked the document numbering. In the Journal entry, i can see that the due date is 02/04/09 where as in the A/R Invoice, i have given the due date as 29/03/09. Now is this the reason for this error? Any suggestions??
Thanks in advance,
JosephDouble check your period setting, Due Date From and To must cover the Due date for the document you are posting. Document Date From and To range should be good too.
Thanks,
Gordon -
Infopath to Sharepoint: Create multiple list items from a date range?
Hi everyone! I have a request from a client to create a SharePoint/InfoPath form that has Start Date and End Date fields. Their request is that when submitted it will make a separate entry for each day in the date range. For example:
John Doe is out from 4/1 - 4/3. When submitted it will make an entry that he was out 4/1, 4/2, and 4/3. this is requested due to them wanting to have a SharePoint list that shows all the day and not use a calendar.
This question was previously posted on another forum by another individual a year ago with no responses so I'm hoping for better results then he got lol.
Any ideas or pointing me in the right direction in terms of how to begin this would be greatly appreciated!
Thanks in advance and I hope everyone is having a great day!I've been asked for things like this in the past too but never found a good solution.
The closest i could think of would be to create a workflow that loops between the two dates and creates an entry for each one (of a different content type) then deletes the inital content entry. I haven't done this so i'm not sure if it's possible without
custom SPD actions. -
Pre-Populating Text fields from a Data drop down list using SQL Server
I'm currently trying to update some of our internal forms which are word based or a basic PDF form you fill in by yourself.
I'm connecting to our SQL server as there are databases stored there for an internal bit of software that hold information
I can use to fill in parts the form.
I have a data drop down list that is dynamically linked to the SQL databass and allows you to select a Project Number from that database, what
I want to do after this is selected is to automatically populate some text fields with the Project name, Account handler and other fields held in the
database.
I've had a look online to see if there is a solution but haven't really found anythig that is similar (although I am new to LC so may have seen it
and not realised) and my Java is non existant.
Has anyone tried this and able to point me in the right directions?
I'm using LiveCycle ES2 version 9.0.0.2 from Creative Suit 5.5 on Windows 7
CheersHi,
Actually this error does not cause any harm except a presentation inconvenience. In my multi-select prompt I am using variable expression with dynamic repository variable. Dashboard results are correct. Just variable's value does not appear on page (error Error Codes: G689FFB3:SDKE4UTF
Expression: @{biServer.variables['CUR_CAL_PER_MONTH_NAME']}). Pushing "GO" button on the prompt fixing the error but it's actually second execution of the dashboard.
Any ideas ?? -
Create text file from form data
I need to create a form using dreamweaver and coldfusion. We
do not have coldfusion server. just Dreamweaver 8. Until we decide
what application server we will use, I need to create a text file
each time a user submits data from a form and put the data into a
text file. What would be the best way to handle this?if you do not have an application server like CF or PHP or
ASP (or
other) to process your form submissions, you should look for
a perl/cgi
script that can do it for you. i remember from awhile ago a
script
called bnbform from bignosebird.com ... it is used for
emailing form
submissions to a designated email address, but if i remember
correctly
it also stored form data in a text file....
Azadi -
Seeking simple example pl/sql to create text file from table data
hello,
I am hoping someone can provide very simple example of creating a file on my local harddrive using a pl/sql program. The basic steps are as follows:
First, I store some text in a varchar2 variable like this:
1. select sometext into otextvar from mytable where recordid = 1;
Second, I want this text to become a file in my data directory:
2. c:\data\sometext.txt
The second step is where I need help.
Any suggestions are greatly appreciated.Use this function
It will create for you a file in your /home/oracle directory with sysdate name and will insert all table names in it
CREATE OR REPLACE PROCEDURE my_proc AS
CURSOR cursor1 IS
SELECT table_name from all_tables;
CURSOR cursor2 IS
SELECT sysdate from dual;
rec1 cursor1%ROWTYPE;
rec2 cursor2%ROWTYPE;
created_file_name VARCHAR2(100);
file_name utl_file.file_type;
BEGIN
OPEN cursor2;
LOOP
FETCH cursor2 INTO rec2;
EXIT WHEN cursor2%NOTFOUND;
created_file_name:=rec2.sysdate;
file_name := utl_file.fopen('/home/oracle', created_file_name,'W');
OPEN cursor1;
LOOP
FETCH cursor1 INTO rec1;
EXIT WHEN cursor1%NOTFOUND;
utl_file.putf(file_name, '%s\n',rec1.TABLE_NAME);
END LOOP;
utl_file.fclose(file_name);
END LOOP;
END my_proc;
SQL>exec my_proc; -
Capturing results from a date range where dates are concatenated with text
my issue_code column has results = OK and the date. An example would be OK20071001 where the last 8 digits is in the YYYYMMDD format.
How can i calculate the # of PO#s that had OK as their issues during a given month.
The sql below shows what i had but i get an error:
SELECT count(unique(SAP_PO_NUMBER)
FROM VENDOR_PURCHASE_ORDER
WHERE SUBSTR(ISSUE_CODE,3,8) BETWEEN
TO_CHAR('20071001', 'YYYYMMDD') AND TO_CHAR('20071101', 'YYYYMMDD')
AND ISSUE_CODE LIKE 'OK%'I'm usually a fan of TO_DATE transformation myself. However in this case I don't feel it is neccessary. The column is already in VARCHAR2 and has a dateformat in an ordered fashion.
why not simply do this:
SELECT count(distinct SAP_PO_NUMBER)
FROM VENDOR_PURCHASE_ORDER
WHERE ISSUE_CODE LIKE 'OK200710%';This statement won't raise an error when skrewed date values are in this column. But I'm not sure if this realy is possible and which version is wanted.
'OK20071043' => Should this result in an error or not?
Message was edited by:
Sven Weller -
In the process of exchanging my defunct Iphone for a new one, some important text messages were lost. The messages obviously did not transfer over to my new phone as I had to restore my new phone from a backup performed a few days ago. Is there a special trick that will allow me to somehow enter my cell number, since it is still the same, in order to recover texts that were received in between wiping my old phone and getting a new one?
You can use an iPhone file explorer such as TouchCopy to get the messages off the old phone. But you can't put them on the new phone as messages. You could put them in a pdf file that you could read on the new phone.
Normally when you get a new phone the first thing you should do is transfer the contents of the old phone to it (Transfer content from an iPhone, iPad, or iPod touch to a new device - Apple Support)). Then the problem does not arise. You are even prompted to do this when you activate the new phone. Once you have started using the new phone without doing this it is too late.
To tell Apple your concern go to http://apple.com/feedback. This is a user to user forum; Apple does not read or participate in it. -
How to exclude weekends & holidays from a date range
Hi Friends,
How can I exclude weekends & other holidays (which are specific to that country only) from a given range of date (if any weenends or holiday falls in that range)?
Please supply some sample code if possible.
Thanks in advance.Enayats_screen wrote:
Hi
I have found the relevant code for your help. May be this will solve your purpose. Please visit the below link
http://www.simplyshareit.net/itemDetails.jsf?q=532&
Thanks.Whew! Thank the gods you saved the OP from having to actually think or learn or clearly communicate his problem!
Maybe you are looking for
-
Hi, i'm having problems with the text input feature, i'd created a comment field but when typing it go only in one line. I would like to know if theres any way to make alow typing in more than one line in the same text field. Sorry for my english, th
-
Office 2013 graveyard colors.
COLOR, Eyestrain, dead; talk about being thrown into the abyss. This is a step back to the first office created by MS; (oh pardon me it had color) what the H... were they thinking. Is it too much to ask for some color, they sure didn't seem to mind
-
I need to reset my Apple ID password, but it says that my security questions were not answered correctly. The email address associated with the questions to reset the answers is no longer available to me. It is my old college email. Does anyone kno
-
Should I install a 32 bit printer driver on a 64 Operating Sytem?
I have an HP Officejet 6700e wireless printer. It is used by 2 computers. The Operating Systems on the computers are as follows: 1 – HP Pavilion laptop using Windows 8.1, 64 bit. 2 – HP Pavilion laptop using Windows 7 Pro, 64 bit. I not
-
Su command won't work in MBA 2011 Lion 10.7.1
Hi All, I have an iMac, 3 MBPs running Lion and Snow Leopard. In all of them, su command works just fine and of course I had no issues with them for many years. I just bought a MBA 2011 and it came with Lion 10.7 which I updated to 10.7.1. The su com