Looking for a formula to calculate difference between two values
So, heres my problem...
I have a set of incremental values which act as thresholds, 100, 200, 300, so on. Another number is independent and correlates to that set of values, say 148.
I want another cell which calculates the difference between 148 and 200, but then recognises that when 148 goes over 200 that the next threshold has been met, so then resets and starts calculating the difference between that new number and the next threshold,
300.
Is it possible to do this all in the same cell?
Thanks in advance.
Re: variable number difference
With the independent number in cell F8, maybe...
=IF(MOD(F8,100)=0,0,100-MOD(F8,100))
Jim Cone
free & commercial excel programs (n/a xl2013)
https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2
Similar Messages
-
Calculate difference between two dates/times
Hi all,
Is there any function module to calculate difference between two dates/times which are in TIMESTAMPL format.
I need to know how many millisconde(second,minutes, hours... )there is between these two times.
Please, It is urgent
Thank you all.
Karimhi,
try the following function
CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
EXPORTING
timestamp1 = timestamp1
timestamp2 = timestamp2
IMPORTING
difference = diff
EXCEPTIONS
OTHERS = 1.
the above function gives the difference in seconds...
try the following code to set the resolution to milliseconds..
SET RUN TIME CLOCK RESOLUTION LOW
check the thread for details:
SET RUN TIME CLOCK RESOLUTION?
all the best!!!
Regards,
Aparna -
Problem with calculate difference between two dates on monday to saturday
Hello,
I need some help to edit a function tu return number of hours between to dates, including saturdays (09:00 - 14:00) and monday to friday (09:00-21:00);
This is my code;
CREATE OR REPLACE
FUNCTION TEST2( FECHA_INICIO DATE, FECHA_FIN DATE)
RETURN NUMBER IS HORASTOTALES NUMBER;
fecha date;
BEGIN
if(
SELECT fecha, to_char(fecha, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') Dia
FROM (SELECT to_date('FECHA_INICIO') + LEVEL - 1 fecha
FROM DUAL
CONNECT BY LEVEL <= (FECHA_FIN - FECHA_INICIO))
WHERE TO_CHAR(FECHA, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') not IN ('SAT') THEN
with t as (
SELECT CASE LEVEL
when 1 then greatest(fecha_inicio,trunc(fecha_inicio) + 9 / 24)
else trunc(fecha_inicio) + level - 15 / 24
end fecha_inicio,
case connect_by_isleaf
when 1 then least(fecha_fin,trunc(fecha_fin) + 21 / 24)
else trunc(fecha_inicio) + level - 3 / 24
end fecha_fin
from dual
connect by level <= trunc(fecha_fin) - trunc(fecha_inicio) + 1 )
select sum(greatest(fecha_fin - fecha_inicio,0)) * 24 horas
into horastotales
FROM T
WHERE TRUNC(FECHA_INICIO) - TRUNC(FECHA_INICIO,'iw') < 5 ;
RETURN HORASTOTALES ;
) ELSE IF
return HORASTOTALES+5;
END;
regardsOk, let's try this one then. it works as a function, and if you extract the query, it can work as a single cursor too.
create or replace function test2( p_start_date date, p_end_date date) return number
is
t_result number;
begin
with firstday as ( select case to_char(p_start_date,'fmdy','NLS_DATE_LANGUAGE=ENGLISH')
when 'sun' then 0
when 'sat' then 9-least(14,to_char(p_start_date,'hh24'))
else 9-least(21,to_char(p_start_date,'hh24'))
end day
from dual ),
alldays as (select sum(case to_number(to_char(p_start_date+level-1,'d'))
when 1 then 0
when 7 then 5
else 12
end) days
from dual
connect by level <= p_end_date - p_start_date + 1),
lastday as ( select case to_char(p_end_date,'fmdy','NLS_DATE_LANGUAGE=ENGLISH')
when 'sun' then 0
when 'sat' then -14+least(14,to_char(p_end_date,'hh24'))
else -21+least(21,to_char(p_end_date,'hh24'))
end day
from dual )
select sum(t1.day+t2.days+t3.day)
into t_result
from firstday t1
, alldays t2
, lastday t3;
return t_result;
end; -
How to find differences between two columns
Hello I need the formula to spot differences between two columns and to write on a third one if the same name appear on the two columns.
For example:
rome berlin true
berlin moscow false
chicago toronto true
toronto chicago true
florence
Thanks
LorenzoYou should be able to use COUNTIF where the range is th first column and the condition is the word in the second column. If the result is greater than zero then the word is in both columns.
-
To calculate the difference between two periods in SSM
Hi,
I have two questions need to be clarified.
Question 1: I have KPI named Revenue growth and the formula to calculate is (current year revenue - previous year revenue).I am using data entry& approval.Is that technically possible to calculate the revenue difference between two periods in SSM?
Question 2: Is that possible to enter the date as input for the variable?for example i want find the difference between two dates and the difference value is output for my variable.
Regards
BalaHi:
Question 1:
We have same problem, and what we did is to create:
- 2 NON KPI:
R1 = Revenue current year
R2 = Revenue previous year
- 1 virtual KPI
R3 = R2-R1
Question 2:
I don't know.
Regards. -
Calculate the Difference Between two dates excluding weekends and Holidays
Hi,
We need to calculate the difference between the two dates by excluding the Local public holidays (It is global and varies across countries) and weekends should not be included in calculation for a business day in OBIEE.
We have two dates: Open date and close date when ever close date is null we are calculating age based on taking the current timestamp and need to exclude the weekends and Holidays when ever the close date is null.
Ex:
Col1 col2 Total
11/9/2010 2:46:38 PM Null 13
11/2/2010 8:06:26 PM 11/3/2010 5:37:03 PM 1
(In the Total we shouldn't include the weekends,holidays)
Please let me know how to calculate the difference between two dates by excluding the weekends and holidays.
Thanks
Edited by: user10441472 on Nov 22, 2010 3:14 PMYou already asked this question and I answered it...
Re: calculation of Business day in OBIEE -
Need Help to calculate difference between times
Hello everyone,
I have two fields which just stores the time in 24 hour format ex: 08:00 and 20:00 now I want to calculate difference between the two times
Kindle help me
Thanks for your help
Thanks
RaviAre your fields of varchar2 datatype or...?
Is 08:00 the start time or 20:00?
Date arithmetic is pretty simple in Oracle if you use the right datatype.
See:
http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551242712657900129
Assuming you are storing strings:
SQL> -- generating sample data:
SQL> with t as (
2 select '08:00' btime, '20:00' etime from dual
3 )
4 --
5 -- actual query:
6 --
7 select numtodsinterval(to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'), 'day') nti
8 , (to_date(etime, 'hh24:mi') - to_date(btime, 'hh24:mi'))*24 dt
9 from t;
NTI DT
+000000000 12:00:00.000000000 12
1 row selected.
SQL> -
Calculate the difference between two dates times in infopath form 2013
Hi,
I have an infopath 2013 form that contains three fields:
2 date time and the 3rd contains the difference between the two in hours
how I can make the difference between the two so that the display will be like this:
Date Time1 08/21/2014 22:00
Date Time2 08/22/2014 1:00
Diff Field 3:00Hi,
Please refer to the following article which matches your requirement exactly.
Calculate the difference between two date picker controls in InfoPath using rules and formulas - no code!
Please mark it answered, if your problem resolved. -
Calculate the difference between two dates
I would like to calculate the difference between two dates in PL/SQL and return the result as a number of days expressed as an integer value.
Denes,
A fair point, I should really have posted this on the SQL forum (I'm new to the forum as well as PL/SQL) but thanks for responding anyway. It does raise a question as to how to implement this in ApEx though.
I have created the function and am calling it as shown below from the source window of a form. The source type is 'PL/SQL expression or function' and the expression in the source window of the form is:
calc_date_difference (:p26_c_payment, :p26_c_rec)
The two parameters being passed are of type date but I'm not sure how to handle the ruturned number and populate the form in ApEx with this value.
Is it possible to do it this way or am I taking completely the wrong approach?
Regards
Sandy
This is not ApEx related but SQL related:
CREATE OR REPLACE FUNCTION calc_date_difference (
p_date_1 VARCHAR2,
p_date_2 VARCHAR2
RETURN NUMBER
v_difference NUMBER;
v_sql_err VARCHAR2 (4000);
BEGIN
v_difference := TRUNC (TO_DATE (p_date_1)) - TRUNC
(TO_DATE (p_date_2));
RETURN v_difference;
CEPTION
WHEN OTHERS
THEN
v_sql_err := SQLERRM || CHR (10) || CHR (10) ||
SQLCODE;
ND calc_date_difference;and
SQL> SELECT calc_date_difference ('23.01.2007',
'20.01.2007') diff
2 FROM DUAL;
DIFF
3
Denes Kubicek -
How to calculate difference between date in hours?
Hi All.
I need calculate difference between first and last date. I'm using the code below:
int differenceDate = CalendarRule.elapsedDays(fromDate : myFirstDate, toDate : myLastDate);
This code return an result in days. But I need that result was in hours.
Has anybody help me?Interval dif;
dif = myLastDate - myfirstDate;
display((dif.hours));
Hope it helps -
API for tools that show differences between two file in applet
I am searching Api for tools that show differences between two data file
that represent as bytes[] in the memory in applet .
the applet is not sign Applet.I gotta it.
File f=new File("\\\\"+"Linshuaibing"+"\\card\\DSC00134.jpg");[Thank you very much v! -
I have bought an iPhone 4S in Brazil and I would like to know if I can replace my old iPhone for a new one (iPhone 5S), at some Apple Store in USA, if I pay just the difference between both values.
You're welcome.
I would advise against that for the reasons I provided.
Could I have my iPad 2 for the new one paying the difference between their values?
No. Sell the existing yourself and use the proceeds to purchase a new iPad. -
How to calculate the hour difference between two dates?
hi all,
how to calculate the hour difference between two dates?
eg i trying this...
((TO_DATE(TO_CHAR(GRNi.reference_date_4,'hh24:mi'),'hh24:mi') -
TO_DATE(TO_CHAR(NVL(GRNi.reference_date_3,SYSDATE),'hh24:mi'),'hh24:mi'))*24)*60 Act_Hr
Reg.
AAKHi
To break the diff between 2 dates into days, hours, minutes, sec -- you can use the following:
select to_char( created, 'dd-mon-yyyy hh24:mi:ss' ),
trunc( sysdate-created ) "Dy",
trunc( mod( (sysdate-created)*24, 24 ) ) "Hr",
trunc( mod( (sysdate-created)*24*60, 60 ) ) "Mi",
trunc( mod( (sysdate-created)*24*60*60, 60 ) ) "Sec",
to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' ),
sysdate-created "Tdy",
(sysdate-created)*24 "Thr",
(sysdate-created)*24*60 "Tmi",
(sysdate-created)*24*60*60 "Tsec"
from all_users
where rownum < 50
HTH
RangaReddy -
SSRS expression for difference between two currency values
Hi All;
I need to get the difference between two currency values
Below is my report
I need to get differene between Actual Income and Profile Income and this value should be in "£" In this example it should be £0.00
Any help much appreciated
Thanks
Pradnya07=sum(Fields!ProfileIncome.Value - Fields!ActualIncome.Value)
This could have either field first, but depends on which field is expected to be larger. You would then format the textbox to show in pounds.
HTH -
How to get the difference between two columns in a column group
Hi All,
My first time here and really new to programming. I would like to get the difference between 2 columns that are inside
a column group.
Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
PeriodNumber
Account 1 2
1) Cash 10,000 15,000
2) Receivables 12,000 11,500
3) Equipment 5,000 5,500
Total Assets 27,000 32,000Hi yabgestopa,
From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
Dim Shared Num1 As Integer
Dim shared Num2 As Integer
Public Function GetAmount(Amount as Integer, Type as String)
If Type = "1" Then
Num1=Amount
Else
Num2=Amount
End If
Return Amount
End Function
Public Function GetDif()
Return Num1-Num2
End function
Right-click the second column to insert a third column with Outside Group-Right.
Then use the expressions below in the matrix.
=Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
=code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
=Code.GetDif()
The report looks like below.
If you have any questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Maybe you are looking for
-
Newbie Question: What happens if I get a new PC?
I just received a black video iPod for Christmas. So far, I've been able to buy, download and watch some TV shows and music from iTunes, and transfer some audio books from CDs and I love it. I have everything on a manual setting. The problem is my PC
-
Question about SOAPBody # extractContentAsDocument()
Hi java experts, I have a question about a method SOAPBody # extractContentAsDocument(). According to its javadoc, http://docs.oracle.com/javase/6/docs/api/javax/xml/soap/SOAPBody.html#extractContentAsDocument%28%29 when you use this method, "The chi
-
SMP 2.3 sp4 Synchronization in the native application on HTTPS
Hi I have a big problem with synchronization on port 443 / https. This is the architecture. At the Relay Server I have installed a trusted certificate in IIS. I do not know what I need to use the certificate in SMP and application code.
-
Alright, so my iPod refuses to stay connected to the internet. Like, I've turned it on and off and on and off about a million times, I've rested the network and there's no way in this world that it's my router because I'm connected to the internet on
-
Weird Problem! Cisco 2950
Hi, I really dont know if this issue is applicable here but I am desperate for help now. We have a wireless project providing internet access in a very remote location. There are wireless mesh accesspoints connected back to back by wireless Point2Mul