Formula Help - Days since last event

jrsomerville

New Member
Joined
Mar 28, 2019
Messages
5
Hi - I was hoping somebody could help me out with an excel formula. I'm in operations at a landscaping company, and I'd like a better way to keep track of how many days it's been since the property was last serviced. Below is an example of the spreadsheet I have. Let's say today's hypothetical date is 4/17/19. I would like the "days since last visit" column to auto-populate "1 day" for Target, "0 days" for Walmart, "5 days" for Kmart, "3 days" for Petco, and "4 days" for Trader Joes. The dates continue through the end of the season which is 10/31/19 so any time I enter an X on a more current date, I would like it to know to change to "days since last visit" column. Thanks in advance for any help! :cool:


SiteDays Since Last Visit4/1/194/2/194/3/194/4/194/5/194/6/194/7/194/8/194/9/194/10/194/11/194/12/194/13/194/14/194/15/194/16/194/17/194/18/19
Targetxxx
Walmartxxx
Kmartxx
Petcoxxx
Trader Joesxxx

<tbody>
</tbody>
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi & welcome to MrExcel.
How about


Excel 2013/2016
ABCDEFGHIJKLMNOPQRST
1SiteDays Since Last Visit12 Mar13 Mar14 Mar15 Mar16 Mar17 Mar18 Mar19 Mar20 Mar21 Mar22 Mar23 Mar24 Mar25 Mar26 Mar27 Mar28 Mar29 Mar
2Target1 daysxxx
3Walmart0 daysxxx
4Kmart5 daysxx
5Petco3 daysxxx
6Trader Joes4 daysxxx
Sheet1
Cell Formulas
RangeFormula
B2=TODAY()-LOOKUP(2,1/(C2:T2<>""),$C$1:$T$1) & " days"
 
Last edited:
Upvote 0
It can also be with the following array formula.

Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself



<b>Sheet</b><br /><br /><table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:77px;" /><col style="width:71px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /><col style="width:51px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td><td >H</td><td >I</td><td >J</td><td >K</td><td >L</td><td >M</td><td >N</td><td >O</td><td >P</td><td >Q</td><td >R</td><td >S</td><td >T</td></tr><tr style="height:39px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="background-color:#92d050; text-align:center; ">Site</td><td style="background-color:#92d050; text-align:center; ">Days Since Last Visit</td><td style="background-color:#92d050; text-align:center; ">12 mar</td><td style="background-color:#92d050; text-align:center; ">13 mar</td><td style="background-color:#92d050; text-align:center; ">14 mar</td><td style="background-color:#92d050; text-align:center; ">15 mar</td><td style="background-color:#92d050; text-align:center; ">16 mar</td><td style="background-color:#92d050; text-align:center; ">17 mar</td><td style="background-color:#92d050; text-align:center; ">18 mar</td><td style="background-color:#92d050; text-align:center; ">19 mar</td><td style="background-color:#92d050; text-align:center; ">20 mar</td><td style="background-color:#92d050; text-align:center; ">21 mar</td><td style="background-color:#92d050; text-align:center; ">22 mar</td><td style="background-color:#92d050; text-align:center; ">23 mar</td><td style="background-color:#92d050; text-align:center; ">24 mar</td><td style="background-color:#92d050; text-align:center; ">25 mar</td><td style="background-color:#92d050; text-align:center; ">26 mar</td><td style="background-color:#92d050; text-align:center; ">27 mar</td><td style="background-color:#92d050; text-align:center; ">28 mar</td><td style="background-color:#92d050; text-align:center; ">29 mar</td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >Target</td><td style="text-align:center; ">1 days </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >Walmart</td><td style="text-align:center; ">0 days </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >Kmart</td><td style="text-align:center; ">5 days </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td >Petco</td><td style="text-align:center; ">3 days </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:18px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td >Trader Joes</td><td style="text-align:center; ">4 days </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td >x</td><td > </td><td > </td><td > </td><td > </td><td > </td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >B2</td><td >{=TODAY()-MAX((IF(C2:T2<>"",$C$1:$T$1))) & " days "}</td></tr></table></td></tr></table> <br /><br />
 
Upvote 0
Thank you so much for your quick reply. I'm sorry to be a huge pain, but I've copy and pasted how my spreadsheet is set up exactly with "Store" being column A, and therefore the "days since last visit" column would be N, etc.. Store is also row 1, store 3014 is row 2, etc.. I wish I knew enough about excel to be able to take the template of your formula and apply it to my situation but I don't. Would you be able to apply the formula you gave to this? I really appreciate it!

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
StorePadRegionStore NameCountyAddressCityStateZip2017 Contractor2018 Contractor2019 ContractorGrass?Days Since Last Visit4/14/24/34/44/54/64/74/84/94/104/114/124/134/14
3014#N/A
3182
3045

<colgroup><col style="width: 178px"><col width="45"><col width="77"><col width="191"><col width="78"><col width="202"><col width="176"><col width="84"><col width="47"><col width="111"><col width="111"><col width="149"><col width="77"><col width="77"><col width="29"><col width="29"><col width="29"><col width="29"><col width="29"><col width="29"><col width="29"><col width="29"><col width="29"><col width="37"><col width="37"><col width="37"><col width="37"><col width="37"></colgroup><tbody>
</tbody>
 
Upvote 0
Try
=TODAY()-LOOKUP(2,1/(O2:AA2<>""),$O$1:$AA$1) & " days"
Change the value in blue to the first column to look at (guessing column O)
& change the red to the last column to look at
 
Upvote 0
=TODAY()-LOOKUP(2,1/(O2:AA2<>""),$O$1:$AA$1) & " days"

It says "
Did not find value '2' in LOOKUP evaluation." and is referring to the 2 after the first "AA"
 
Upvote 0
Did you type the formula in, or copy/paste?
As it works for me, also I have never come across an error message like that before.
 
Upvote 0
I used this spreadsheet in Google Sheet and downloaded and opened it in Excel and it works there. Thank you and sorry for the trouble!

Another question you might be able to help me with: Is there a formula to change the cell fill color to red when the cell changes to "8 days" and stays red until serviced?
 
Upvote 0
CellFormula
N2{=TODAY()-MAX((IF(O2:AF2<>"",$O$1:$AF$1))) & " days "}

<tbody>
</tbody>

<tbody>
</tbody>

Array formula
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
 
Last edited:
Upvote 0
Thank you, I combined both tips and made the formula "=arrayformula(TODAY()-LOOKUP(2,1/(O2:HU2<>""),$O$1:$HU$1) & " days")" and it works perfectly in Google Sheets now.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,901
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top