SOLVED

Display number based on number of days past cell date

Copper Contributor

I am working on trying to get an output for training classes.  Based on the date they start training I want to automatically populate which week of training they are in. I am including weekends (or open to other thoughts)

 

I have a date in cell N4, I want cell O4 to display "1" if <= 7 days, "2" if between 7 and 13, "3" if between 14 and 21, "4" if between 22 - 29, anything greater "graduated"

16 Replies

@robert_leblancmention 

=IF(TODAY()-N4<=7,1,IF(AND(TODAY()-N4>=7,TODAY()-N4<=13),2,IF(AND(TODAY()-N4>=14,TODAY()-N4<=21),3,IF(AND(TODAY()-N4>=22,TODAY()-N4<=29),4,"graduated"))))

 

Is this the formula you are looking for?

I am not sure it works exactly. For example "N" column has a date of 10/11/2021 and it displays "1", but should display "4". as that is 28 days from the date in the N column. and some of the cells almost a year old are showing a number rather than graduated. not sure why.

@robert_leblancmention 

The formula i sent you originally was wrong, sorry. I meanwhile sent you the corrected formula.

 

how did you send it? I am new to the forum.

Here are two other variations:
=IF(INT((N4-M4)/7)<4,INT((N4-M4)/7)+1,"Graduated")

Or if you have an "Up-To-Date" Microsoft (Office) 365 subscription, a slightly faster version would be:
=LET(WeekDiff,INT((N4-M4)/7),
IF(WeekDiff<4,WeekDiff+1,"Graduated")
)

 

I'm making the assumption that your 22-29 was really intended to be 22-28.  

best response confirmed by robert_leblancmention (Copper Contributor)
Solution

@robert_leblancmention 

=IF(TODAY()-N4<=7,1,IF(AND(TODAY()-N4>=7,TODAY()-N4<=13),2,IF(AND(TODAY()-N4>=14,TODAY()-N4<=21),3,IF(AND(TODAY()-N4>=22,TODAY()-N4<=29),4,"graduated"))))

 

I sent it a few minutes ago. Here it is again. 

 

 

I think the revised works. TY. One more question. I forgot to mention display "0" if date has not occurred yet and display nothing if the field is blank (this way I can populate the field with formula all the way down.

It is housed on teams, will that field update the number automatically

@robert_leblancmention 

As a comment, the best way to exchange formulae is to share simple sample Excel file without sensitive content. Screenshots and like are not very useful and not very informative. Formulae could be duplicated (and better if they are) in the post to illustrate the discussion, but they could be for different locale, could include wrong (for formulae) HTML symbols, etc. Excel file converts everything automatically, thus you are locale independent.

the other two do not work as the hire date (M4) has no correllation with the date in N4
thank you for the advice. I think it mentioned something about including screenshot to assist, so that is why I put it.

@robert_leblancmention 

=IF(N4-M4<=7,1,IF(AND(N4-M4>=7,N4-M4<=13),2,IF(AND(N4-M4>=14,N4-M4<=21),3,IF(AND(N4-M4>=22,N4-M4<=29),4,"graduated"))))

 

Please try this formula. I assumed that you wanted to compare date of column N with date of today.

@robert_leblancmention 

That's only a comment for future. Recommendations are here Welcome to your Excel discussion space! - Microsoft Tech Community. File is on the first place, screenshot and other supporting content is always welcome.

probably my fault the first revised formula you sent works great.

=IF(TODAY()-N4<=7,1,IF(AND(TODAY()-N4>=7,TODAY()-N4<=13),2,IF(AND(TODAY()-N4>=14,TODAY()-N4<=21),3,IF(AND(TODAY()-N4>=22,TODAY()-N4<=29),4,"graduated"))))

Only relevant date is in N4.

Try this to address the Blank Cells and Not happened yet situations:

=LET(WeekDiff,ROUNDUP((TODAY()-N4)/7,0),
IF(ISBLANK(N4),"",
IF(WeekDiff<=0,0,
IF(WeekDiff<=4,WeekDiff,"Graduated")))
)

 

To refence cell M4 instead of tod, just change "Today()" to M4  Like this:
=LET(WeekDiff,ROUNDUP((M4-N4)/7,0),

1 best response

Accepted Solutions
best response confirmed by robert_leblancmention (Copper Contributor)
Solution

@robert_leblancmention 

=IF(TODAY()-N4<=7,1,IF(AND(TODAY()-N4>=7,TODAY()-N4<=13),2,IF(AND(TODAY()-N4>=14,TODAY()-N4<=21),3,IF(AND(TODAY()-N4>=22,TODAY()-N4<=29),4,"graduated"))))

 

I sent it a few minutes ago. Here it is again. 

 

 

View solution in original post