PPRuNe Forums - View Single Post - Log Book Summary Formuala
View Single Post
Old 19th Sep 2010, 12:29
  #6 (permalink)  
john_tullamarine
Moderator
 
Join Date: Apr 2001
Location: various places .....
Posts: 7,187
Received 97 Likes on 65 Posts
Have a read of the array function which is set up exactly for this sort of thing. Indeed, I have a requirement for aircraft operation type additions with maintenance records and that is exactly analogous to the logbook thing you are trying to do.

Set up the tables as you would do normally, ie including something like

Column 1 ....... Column 2
(rangeA:B)..... (rangeX:Z)

C172N...............2.55
GY180...............0.45
PA18.................3.50

etc

Put the following sort of formula in the cell where you want to do the selective addition and then execute it using CTRL-SHIFT-ENTER rather than the normal ENTER. This tells Excel it is an array variable which you can recognise by the { } squiggly brackets around the whole expression. Also the active cell remains the same after you execute the operation.

{=SUM(IF(rangeA:rangeB="keyword",rangeX:rangeZ,""))}

This might become, say

{=SUM(IF(C5:C457="C172N",G5:G457,""))}

[note that you don't type in the squiggly brackets - Excel puts them in when you execute the expression]

which says to Excel something like ..

"Look down column C between rows 5 and 457, inclusive, and, if the aircraft type for the row in question is C172N, then go over to column G at that row and add the value there to a running total for C172N.

However, if the aircraft type in column C is NOT C172N, ignore that row, go onto the next row and do the exercise again ..."

To save your having to change the range just set up the log with a lot of empty rows which you fill in progressively.

I just set up a sample as above and it works real beaut ... However, I recall the hassles I had getting on top of array operations in Excel so, if you have a problem with this by all means send me a copy of part of your spreadsheet and I'll set it up for you.

(Ignore the dot leaders - I've forgotten how to set up columns in PPRuNe so the dots are the next best thing I can find to make it look like columns)
john_tullamarine is offline