Finding last cell with data

SMK

New Member
Joined
Apr 9, 2007
Messages
6
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!
 

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
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>
 

SMK

New Member
Joined
Apr 9, 2007
Messages
6
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.
 

Dan Waterloo

Well-known Member
Joined
Jan 4, 2007
Messages
874
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

New Member
Joined
Apr 9, 2007
Messages
6
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?
 

Dan Waterloo

Well-known Member
Joined
Jan 4, 2007
Messages
874
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,149
Messages
5,600,012
Members
414,355
Latest member
Aruna Kallu

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
Top