Excel Formula Help
Author
Discussion

HiRich

Original Poster:

3,337 posts

292 months

Sunday 11th December 2005
quotequote all
Right, I'm building a table in excel that identifies the attendees at various races over a decade for some historic racing research.

The top two rows identify the date and location of the race
The first few columns identify the driver and car (and specific chassis)

Now in the heart of the table, most cells are blank (reasonably, as I have some 200 races and 200 driver/chassis combinatons from the first five years). But in cells where a driver/chassis combinations attended a particular race, there is a character in the cell. This might be:
A number: for the finishing position
A character(s): For others (R=Retired, NS= Did not start)
Another character (a black blob, like a bullet point): Meaning we know they were there, but not the result.

What I want to do is add a couple of columns of formulae, to identify first sighting and last sighting for each driver/chassis. So for each row, it needs to find the leftmost (and rightmost) non-blank cell in that row, and display the date from Row 1.

So can Excel do this? If it helps, I can restrict the range (e.g. Column 5 to a nominal Column 1,000).

Thanks in advance.

GreenV8S

31,024 posts

314 months

Monday 12th December 2005
quotequote all
I guess you can use a simple 'match' formula to find the first non-blank column in a range, not sure how you'd find the last non-blank column. Hopefully it won't be necessary to resort to script.

victormeldrew

8,293 posts

307 months

Monday 12th December 2005
quotequote all
Congratulations on the most obtuse spreadsheet design!

I'd suggest to build a table instead which holds driver, chassis, location, date, result in columns. Then use pivottable to create the spredsheet you want. Driver and chassis as rows, location and date as columns, max of result as data. The non numerics will show as a zero. Turn subtotals off for driver and location, and grand totals.

To answer the question of when a driver or chassis was first/last seen drag driver, chassis and location to "page fields", and sort date either ascending or descending after picking your driver, chassis and location from the page field dropdowns.

By dragging the fields around you will be able to extract all sorts of info from your "database".

With your present design you have no option but to write VBA scripts.

fish

4,064 posts

312 months

Monday 12th December 2005
quotequote all
You can do what you want with VLOOKUPs and HLOOKUPS however there is a few tricks to get it doing hat you want or you will end up in the VB route.

If you want me to sort it drop me an e-mail and I'll write it.

victormeldrew

8,293 posts

307 months

Monday 12th December 2005
quotequote all
Doh! That'll teach me to post on techie subject after witching hour.

I think you may need to use a combination of HLOOKUP and MATCH.

Assuming a table with columns A:L something like this would get the date corresponding to the first non-null on row 10:

=OFFSET($A$1,1,MATCH(HLOOKUP("x",B10:L10,1,TRUE),B10:L10,0)+1,1,1)

The HLOOKUP for "x" is expected to fail ("x" wasn't one the values you specified you were using). The TRUE following it says return the first value greater than that. It won't work if you enter your results in lowercase though. The B10:L10 range will vary depending on what columns you are using.

This works for the non numeric results, but not for the numbers. You could have a second worksheet which converts your table into text values (and makes them uppercase) and do the lookup on that instead to make it work, unless there is an easier way I am missing. You could enter the data as P1, P2, P3 etc of course!


HiRich

Original Poster:

3,337 posts

292 months

Monday 12th December 2005
quotequote all
Thanks for the advice. I've bounced a copy to fish to see whether two heads can come up with a solution. It's not essential, but would be very useful when researching a particular driver or chassis history. I appreciate the design is "obtuse", and a blatant misuse of Excel, but it's already proving much more effective than what we had before, and is so close to doing everything we need of it.

fish

4,064 posts

312 months

Tuesday 13th December 2005
quotequote all
Didn't get chance to look last night as we were travelling from Ireland. Will have a bash at it tonight.

James

AtomicRex

862 posts

257 months

Wednesday 14th December 2005
quotequote all
Match and Index are faster than any of the look ups

fish

4,064 posts

312 months

Wednesday 14th December 2005
quotequote all
Made some changes and have e-mailed it back last night hope it is ok