12.07.2015 Views

Excel Add-in Development in C/C++: Applications in ... - F9

Excel Add-in Development in C/C++: Applications in ... - F9

Excel Add-in Development in C/C++: Applications in ... - F9

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10 <strong>Excel</strong> <strong>Add</strong>-<strong>in</strong> <strong>Development</strong> <strong>in</strong> C/<strong>C++</strong>Table 2.2 (cont<strong>in</strong>ued)A1 styleR1C1 styleLeft-most column <strong>in</strong> sheet A C1Right-most column <strong>in</strong> sheet IV C256Relative reference style as shown by formula =A2entered <strong>in</strong>to cell B1.=A2 =R[1]C[-1]Absolute reference style as shown by formula =$A$2entered <strong>in</strong>to cell B1.Mixed reference style as shown by formula =A$2entered <strong>in</strong>to cell B1.=$A$2=$A2=R2C1=R2C[-1]Relative reference <strong>in</strong> same row or column as shownby formula =A2 entered <strong>in</strong>to cells B2 and A1.=A2 =RC[1] (<strong>in</strong> cell A1)=R[-1]C (<strong>in</strong> cell B2)Note: The <strong>in</strong>dex <strong>in</strong> square brackets <strong>in</strong> relative references <strong>in</strong> R1C1 style can be any numberfrom −65,535 to +65,535 <strong>in</strong>clusive.2.3 CELL CONTENTSInternally, a cell with<strong>in</strong> <strong>Excel</strong> has a great deal of data associated with it. This <strong>in</strong>cludes thedisplay format, attached comments (notes), protection status, etc. The two most importantproperties for someone wish<strong>in</strong>g to write functions are:1. The cell’s formula – a text str<strong>in</strong>g that <strong>Excel</strong> parses to an <strong>in</strong>ternal compiled form, andwhich is then used to re-evaluate the cell <strong>in</strong> a recalculation.2. The cell’s value – if the cell conta<strong>in</strong>s a formula, the result of its evaluation, otherwisethe data that was entered directly by the user or an <strong>Excel</strong> command or macro.2.4 WORKSHEET DATA TYPES AND LIMITSFrom a spreadsheet user’s perspective, the type of value of any non-empty cell (or groupof cells <strong>in</strong> the case of an array) will always be one of the follow<strong>in</strong>g:• a number (float<strong>in</strong>g po<strong>in</strong>t);• a Boolean value (TRUE or FALSE);• a character str<strong>in</strong>g;• an <strong>Excel</strong>-specific error code;• an array comprised, <strong>in</strong> general, of a mixture of the above types.<strong>Excel</strong> will always evaluate a cell formula to one of these data types. Sometimes thefunction <strong>in</strong> the cell will return someth<strong>in</strong>g other than one of these, such as a range reference,but <strong>Excel</strong> will then evaluate this to one of these types.The formatt<strong>in</strong>g applied to a cell can, of course, make the appearance of a number itconta<strong>in</strong>s very different. A number may appear as a date, a time, a percentage, a currencyamount, <strong>in</strong> scientific notation or as a formatted fraction. Note that <strong>Excel</strong> doesn’t dist<strong>in</strong>guishbetween <strong>in</strong>teger and float<strong>in</strong>g-po<strong>in</strong>t numbers on a worksheet. A function that takes <strong>in</strong>teger

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!