tags:

views:

54

answers:

2

Hello people!

I'm trying to write an Excel Function that grabs the data out of a neighboring cell in the same row. What is the proper function to do this? I've been searching for hours and cannot find it.

Thank you!!!

A: 

Perhaps Offset would suit: http://www.techonthenet.com/excel/formulas/offset.php

Remou
This looks like it would work but how do I set the 'reference' cell to the one containing the function?
Sharon
In VBA? char char
Remou
Not VBA, just in Excel (it's a cell function) - take a look at the offset parameters; range, etc etc etc. The range is like the "base" cell, but I need it to be relative to the cell in which the function is inserted. Do you know how to reference it "self". (like in jquery/js, you would just put 'this' as the range)
Sharon
i don't believe that in-cell excel functions work like that. it's more absolute, where the cell references an exact other cell to grab data. however, excel does a lot of the legwork for you should rows/columns modify so that you aren't always updating your references.
Jason
ok dang. thanks
Sharon
+1  A: 

If you're trying to grab info in column A and maybe multiply it by something in column B in your B cell you would do:

=A1*2

Is this what you're talking about? This seems maybe too straightforward...

EDIT Try this:

=$A1*2

and then drag the little square in the lower right corner of the cell down as many rows as you need.

Jason
This is what I'm looking for, only relative, so it will work in any row, not just A1's row.
Sharon
are you just writing an in cell function or a VBA macro?
Jason
Cell function - take a look at the offset comment, it will work but I need to know how you reference "it's own cell" for the range.
Sharon