Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do i comapre 2 columns

a formula can't do that unless the values in column B a produced by a
formula

=if(A1="C",-25,Current formula for B)

or in column C you could put in C1
=if(A1="C",-25,B1)
then drag fill this down your column. Then select the cells in C, do
Edit=Copy, then select B1 and do Edit=Pastespecial and select Values.

for code

Sub ReplaceValuesInB()
range(B1").Select
do
if activeCell.offset(0,-1).Value = "C" then
activeCell.Value = -25
End if
activeCell.offset(1,0).Select
loop while not isempty(activeCell)
End Sub

test any of these on a copy of your data.


--
Regards,
Tom Ogilvy


"Leo" wrote in message
...
HI Prods
I have situation here.
I have a column A and B
A B
D 25
C 23
D 45
C 56
D 34

Ineed to write a formula to compare these columns for the condition
if the cloumn A has the value C the the corresponding value in column B
should become -25.
How do i do this please let me know about it.
Thanks
Diwakar




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Match data then comapre and return new data [email protected] Excel Worksheet Functions 0 June 18th 08 12:53 PM
Macro for comapre and copy Arain Excel Discussion (Misc queries) 13 April 18th 07 11:16 PM
comapre two list of data & arranging in a same manner Sachin New Users to Excel 1 November 25th 06 01:28 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM
comapre two lists mansure Excel Discussion (Misc queries) 2 November 28th 04 01:57 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"