Outline ·
[ Standard ] ·
Linear+
Microsoft Excel formulae....... How to do this?
|
TSscyap
|
May 1 2008, 11:20 PM, updated 18y ago
|
|
well i wanted to google but i cant think of the key words so... i want a formula to count Months from one point to ANOTHER point and NOT a formula to count Months from one point to CURRENT point/time does anyone know how to do this?? i want to do something like " If point A to B is 10 months, do action A" and " If point A to B is 20months, do action B" help pls
|
|
|
|
|
|
firedauz
|
May 2 2008, 01:22 AM
|
|
Its best if you ask this specific question from Software or Codemaster section. (Q&A is like for general questions) You'll have much better chances in those 2 sections, gudluck
|
|
|
|
|
|
KooHei
|
May 2 2008, 12:13 PM
|
|
didn't know excel comes with if statement...
|
|
|
|
|
|
beelzebob13
|
May 2 2008, 02:04 PM
|
|
quite difficult to do in excel because of how excel lack features/functions that involves manipulation/calculations based on dates...not impossible but will be quite complicated. i tried and it ain't pretty...
|
|
|
|
|
|
PSY84
|
May 2 2008, 10:13 PM
|
|
use the IF() function, if(logic, true, false) eg =if(C1=10, B2+C2, B3+C3)
it's like if c1=10, then B2+C2, else B3+C3
or you can do multiple loop/condition inside eg =if(if(if(......) ) )
|
|
|
|
|
|
TSscyap
|
May 2 2008, 10:18 PM
|
|
QUOTE(firedauz @ May 2 2008, 01:22 AM) Its best if you ask this specific question from Software or Codemaster section. (Q&A is like for general questions) You'll have much better chances in those 2 sections, gudluck  ah yah but would that be double posting? QUOTE(PSY84 @ May 2 2008, 10:13 PM) use the IF() function, if(logic, true, false) eg =if(C1=10, B2+C2, B3+C3) it's like if c1=10, then B2+C2, else B3+C3 or you can do multiple loop/condition inside eg =if(if(if(......) ) ) yeah i know that IF function and logical test ETC but i wanna know how to set one logical test to calculate months???
|
|
|
|
|
|
firedauz
|
May 2 2008, 10:23 PM
|
|
It should be understandable even if its double-posting. "Not alot of people are able to answer it here" is the important factor in this case.
|
|
|
|
|
|
wlcling
|
May 8 2008, 03:05 PM
|
|
oooo... i love excel challenges
Do you have a lot of different conditions or just two? If it's just two, here goes:-
Let's say you have date 1 on cell A1, and date 2 on cell B1 (I.e, you want to make a condition based on the number of months date 2 is from date 1)
First you need a simple formula to count the difference in months which is this:- =(MONTH(B1)-MONTH(A1))+((YEAR(B1)-YEAR(A1))*12)
Next to create the IF statement:- =IF((MONTH(B1)-MONTH(A1))+((YEAR(B1)-YEAR(A1))*12)=10,"Action A",IF((MONTH(B1)-MONTH(A1))+((YEAR(B1)-YEAR(A1))*12)=20,"Action B","No condition matched!"))
Done!
|
|
|
|
|
|
dopodplaya
|
May 8 2008, 03:07 PM
|
|
use datediff la brother. gile panjang kod, tapi tak betul muahaha.
|
|
|
|
|
|
wlcling
|
May 8 2008, 03:15 PM
|
|
QUOTE(dopodplaya @ May 8 2008, 03:07 PM) use datediff la brother. gile panjang kod, tapi tak betul muahaha. datediff?? What is the syntax like, could you list it out?
|
|
|
|
|
|
dopodplaya
|
May 8 2008, 03:20 PM
|
|
The syntax for DATEDIF is as follows: CODE =DATEDIF(Date1, Date2, Interval) Where: Date1 is the first date, Date2 is the second date, Interval is the interval type to return. Example - different of date in month CODE =DATEDIF(Date1,Date2,"m") QUOTE Code for Interval
m - Months Complete calendar months between the dates. d - Days Number of days between the dates. y - Years Complete calendar years between the dates. ym - Months Excluding Years Complete calendar months between the dates as if they were of the same year. yd - Days Excluding Years Complete calendar days between the dates as if they were of the same year. md - Days Excluding Years And Months Complete calendar days between the dates as if they were of the same month and same year. This post has been edited by dopodplaya: May 8 2008, 03:21 PM
|
|
|
|
|
|
suiteng
|
May 8 2008, 03:37 PM
|
|
I just use date2 - date1 = answer
|
|
|
|
|
|
wlcling
|
May 8 2008, 03:51 PM
|
|
QUOTE(dopodplaya @ May 8 2008, 03:20 PM) The syntax for DATEDIF is as follows: CODE =DATEDIF(Date1, Date2, Interval) Where: Date1 is the first date, Date2 is the second date, Interval is the interval type to return. Example - different of date in month CODE =DATEDIF(Date1,Date2,"m") Cool! Didn't know of such function. Thanks for sharing! QUOTE(suiteng @ May 8 2008, 03:37 PM) I just use date2 - date1 = answer  that would give the difference in days, so won't work for this case.
|
|
|
|
|