# Use newest date in a range for formula

#### liiiiiiiiza

##### New Member
I am a Field Sales rep and I have an excel report of what hospitals I went to on what days.

I'm trying to make a heat map using conditional formatting to visualize time passage regarding who I haven't visited recently. I'm using the below formula to pull up the visit date minus today's date which works well for the heat map:

=(Sheet3!\$A\$4-TODAY())

This works with business that show up a single time in my report (one visit, like "Happy Tails Hospital" below). However, here is where I'm hitting a snag: If I visited a business multiple times recently, it will show up as multiple entries (like "Claws and Paws" below). When there are multiple entries, I need a way to have the formula use the newest date for that business to calculate the time passage. So for Claws and Paws, I would need it to apply the 3/5/2020 date to the "heat map" formula from the Raw data sheet.

Raw data sheet:

Heat map sheet:

#### Attachments

• 1592683839872.png
23.9 KB · Views: 4

### Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

#### gaz_chops

##### Well-known Member
Try -
Change the sheet name to match yours

=MAX(IF(Raw data sheet\$B\$2:\$B\$9=A2,Raw data sheet\$A\$2:\$A\$9))-TODAY()

Enter as an array with Ctrl, Shift & Enter

#### liiiiiiiiza

##### New Member
THIS WORKED! You're a genius! I need to learn about arrays.

#### gaz_chops

##### Well-known Member
You're welcome, thanks for the feedback.

Replies
1
Views
298
Replies
3
Views
99
Replies
1
Views
411
Replies
0
Views
151
Replies
18
Views
290

1,130,174
Messages
5,640,599
Members
417,154
Latest member
gm_jagath

### 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.

### Which adblocker are you using?

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

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