ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copying formula to another cell (https://www.excelbanter.com/excel-discussion-misc-queries/125715-copying-formula-another-cell.html)

dmack

copying formula to another cell
 

Have formula =if(a1=1,"1",if(b1=2","2")) in Column E. How do i drag the
formula to Columns F and G so that the formula changes show
=if(a2=1,"1",if(b2=2,"2")) in row F and =IF(a3=1,"1",if(b3=1"1")) in row G.

Currently if i drag the formula to another column in Row E, i get the
following result: =if(b1=1,"1",if(c1=2"2")) and =if(c1=1"1",if(d1=2,"2")).

Hope this makes sense!!
--
thanx

meatshield

copying formula to another cell
 

dmack wrote:
Have formula =if(a1=1,"1",if(b1=2","2")) in Column E. How do i drag the
formula to Columns F and G so that the formula changes show
=if(a2=1,"1",if(b2=2,"2")) in row F and =IF(a3=1,"1",if(b3=1"1")) in row G.

Currently if i drag the formula to another column in Row E, i get the
following result: =if(b1=1,"1",if(c1=2"2")) and =if(c1=1"1",if(d1=2,"2")).

Hope this makes sense!!
--
thanx


The easiest way (if you don't have to do it too many times) would be to
use fill down (that is what you are referring to when you say "drag" I
think - you're clicking on the bottom right corning and "dragging" the
cursor somewhere) to fill the formulas into E1:E3. Then just move the
formula in E2 to F1 (mouse over the edge of the cells until the plus
turns into a plus with arrows on the end, then click and drag).

To keep a formula from changing the relative reference when you fill
right to left, you can use the $
e.x.=if($a1=1,"1",if($b1=2,"2"))
If this is in E1 and you fill it to F1, you will have the same formula.
But, if you fill down from E1 to E2, the formula will be
=if($a2=1,"1",if($b2=2,"2"))
Hope this helps!


RagDyeR

copying formula to another cell
 
Try this:

=IF(INDEX($A:$A,COLUMNS($A:A))=1,"1",IF(INDEX($B:$ B,COLUMNS($A:A))=2,"2"))

Comments:

Do you really want quotes around "1" and "2"?
This makes them TEXT, *not* numbers.

Your formula has no return if Column A and Column B *do not* contain a 1 and
a 2,
Just a FALSE display.
--

HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===

"dmack" wrote in message
...

Have formula =if(a1=1,"1",if(b1=2","2")) in Column E. How do i drag the
formula to Columns F and G so that the formula changes show
=if(a2=1,"1",if(b2=2,"2")) in row F and =IF(a3=1,"1",if(b3=1"1")) in row G.

Currently if i drag the formula to another column in Row E, i get the
following result: =if(b1=1,"1",if(c1=2"2")) and =if(c1=1"1",if(d1=2,"2")).

Hope this makes sense!!
--
thanx



Sean Timmons

copying formula to another cell
 
There's probably some macro or VB code to do it, but my way would be:

copy your forumla down the column
highlight the column, find "A", replace with $A$ then do the same for "B"
Copy -Paste Special -Transpose
Will flip it sideways.
Then you delete the formulas that are still in column format.


"dmack" wrote:


Have formula =if(a1=1,"1",if(b1=2","2")) in Column E. How do i drag the
formula to Columns F and G so that the formula changes show
=if(a2=1,"1",if(b2=2,"2")) in row F and =IF(a3=1,"1",if(b3=1"1")) in row G.

Currently if i drag the formula to another column in Row E, i get the
following result: =if(b1=1,"1",if(c1=2"2")) and =if(c1=1"1",if(d1=2,"2")).

Hope this makes sense!!
--
thanx


David Biddulph

copying formula to another cell
 
To start with, your column E formula has an error (an unmatched extra double
quote mark).
I assume that you mean =if(a1=1,"1",if(b1=2,"2")) [but see also the last
para of my reply]?
In most of your other formulae, you're missing a comma, so again have
invalid syntax. Rather than typing the formulae into the message, you're
better off copying and pasting, then you hopefully won't suffer from
typographical errors.
Furthermore, you're likely to confuse folk when you get muddled up between
rows and columns. There isn't a row E, row F, or row G.

Having cured that, you can hopefully get the result you want by using
=IF(OFFSET($A1,COLUMN()-5,0)=1,"1",IF(OFFSET($B1,COLUMN()-5,0)=2,"2"))

But do you really want your output to be "1" and "2" as text, or do you want
numbers? If numbers, throw away the quote marks.
--
David Biddulph

"dmack" wrote in message
...

Have formula =if(a1=1,"1",if(b1=2","2")) in Column E. How do i drag the
formula to Columns F and G so that the formula changes show
=if(a2=1,"1",if(b2=2,"2")) in row F and =IF(a3=1,"1",if(b3=1"1")) in row
G.

Currently if i drag the formula to another column in Row E, i get the
following result: =if(b1=1,"1",if(c1=2"2")) and =if(c1=1"1",if(d1=2,"2")).

Hope this makes sense!!
--
thanx





All times are GMT +1. The time now is 04:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com