# Finding last cell with data

#### SMK

##### New Member
Hello. I have a spreadsheet that has a list of distributors across the top and dates down the side. I have an x in each date cell where the distributor ordered one of our products, like this:

A
2/12 x
2/13
2/14
2/15 x
2/16
2/17
2/18 x

I want to count the number of days in between when they ordered. In other words, for distributor "A", I want a formula that will count the number of days between 2/12 and 2/15, then the number of days between 2/15 and 2/18. Anybody have any ideas on the best way to do this? Your help would be very much appreciated!

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
is every row a date?

<code>
dim rowc as double
dim day as double
day = 0
rowc = 1
do
if cells(rowc,1) = 2/12 then
exit do
else
rowc = rowc +1
end if
loop while rowc< 64000

do
if cells(rowc,1) = 2/18 then
msgbox("The Amount of days is " & day)
exit do
else
day = day +1
end if
loop while rowc < 64000

</code>

Each row is a date and each column is a distributor. There are x's on the rows for the date which a distributor orderd a product. I'm afraid I don't quite understand what you were saying in your last reply.

SMK: Where do you want to put the values that you calculate? It looks like the dtaes are in column A, the orders for the first distributor are in column B, the orders for the second distributor are in column C, etc. So where will you put the 2 that is the number of days between 2/12 and 2/15 for the first distributor?

SMK: Where do you want to put the values that you calculate? It looks like the dtaes are in column A, the orders for the first distributor are in column B, the orders for the second distributor are in column C, etc. So where will you put the 2 that is the number of days between 2/12 and 2/15 for the first distributor?

Thank you for replying. You're correct about the columns. I plan on putting the number of days right below all of my x's underneath the distributor. In other words, if my dates go down to row 200 in Column A, then I'll want to put my number of days on rows 201 and 202 (or however many I need thereafter) for each distirbutor. Does that make sense?

I think it will be difficult to write formulas that can handle.

I suggest devoting a second column to each distributor. So the first distributor would get columns B and C, #2 would get D and E, etc.

The second column would contain values only on dates where there is an order recorded in the first column and that value would be the number of days since the previous order.

It would be even simpler the dates are not listed in a row of the left hand side but recorded in the first column for each distributor.

E.g.

Dist1_Order; Days1; Dist2_Order; Days2
2007-02-12; ; 2007-02-17; ;
2007-02-15; 3; 2007-02-24; 7
2007-02-26; 11; 2007-02-25; 1
; ; 2007-02-28; 3

(I'm using semi-colons to delimit the columns).

Then the formula in the Days1 column in B3 would be
=A3-A2
and you would just copy it down column B.

However, you may using the dates in column A for another puropse as well in which case this doesn't work.

Replies
3
Views
245
Replies
6
Views
191
Replies
0
Views
142
Replies
4
Views
237
Replies
2
Views
270

1,206,758
Messages
6,074,769
Members
446,086
Latest member
daywi

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