ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Formulas (https://www.excelbanter.com/excel-worksheet-functions/140389-formulas.html)

rnello

Formulas
 
I am trying to create a formula that would perform the following task.
Compare the value in B3 to the value in B2
If identical then:
Copy the word DUP into cell C2 and then move the information from cells D3
thru G3 to cells D2 thru G2

If not identical then perform no action and move onto the next cell
comparison.
--
Thank you, Rich

Barb Reinhardt

Formulas
 
This is something you'd have to do through VBA rather than functions. Is
that what you want?

"rnello" wrote:

I am trying to create a formula that would perform the following task.
Compare the value in B3 to the value in B2
If identical then:
Copy the word DUP into cell C2 and then move the information from cells D3
thru G3 to cells D2 thru G2

If not identical then perform no action and move onto the next cell
comparison.
--
Thank you, Rich


JE McGimpsey

Formulas
 
Formulae only return values to their calling cells, they can't "put"
values in other cells.

You could use a macro:

Public Sub MoveDuplicateInfo()
Dim rCell As Range
For Each rCell In Range(Cells(2, 2), _
Cells(Rows.Count, 2).End(xlUp).Offset(-1, 0))
With rCell
If .Value = .Offset(1, 0).Value Then
.Offset(0, 1).Value = "DUP"
.Offset(0, 2).Resize(1, 4).Value = -
.Offset(1, 2).Resize(1, 4).Value
End If
End With
Next rCell
End Sub
In article ,
rnello wrote:

I am trying to create a formula that would perform the following task.
Compare the value in B3 to the value in B2
If identical then:
Copy the word DUP into cell C2 and then move the information from cells D3
thru G3 to cells D2 thru G2

If not identical then perform no action and move onto the next cell
comparison.



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

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