Choosing cell with most recent cost

Adam459

New Member
Joined
Sep 7, 2011
Messages
3
Hello,

I'm hoping you can help me with a problem im facing while attempting to put in place a macro to automate one of the files we use. The table is arranged as so:

http://imageshack.us/photo/my-images/824/questionp.jpg/

What my aim is with the macro, is to label each of the individuals with only one location. That location will be the location in which the most recent cost occured (e.g. for person E in the above example, it would label him as 'UK'). A lookup is hence not suitable as it would only pick the first location in the data.

There's a few catches, the data which produces this report does not have a fixed amount of weeks, and hence I would like it to work should with any number of columns.

Also, there may be some individuals on there which have over 10 locations (although very much in the minority) and hence a nested IF statement would be far too long.

Finally, there may be some individuals with no cost in some weeks (see C) or who may have no costs at the start (see E/F).

I am trying to be as flexible as possible so that the process works whatever the data looks like, but am currently struggling. The ideal formula would be to check if the same ID occoured in the first columns range, and if it did then provide me with the location who's cost occured most recently - else simply provide their location (as they've only got one line).

If anyone has any ideas, I would be very grateful.

Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
This forum moves so quickly, can anyone lend any assistance? I can't even seem to get the logic right in order to do this.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,681
Members
452,937
Latest member
Bhg1984

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