Cell values based on comparison of previous column cell value.

Deepk

Board Regular
Joined
Mar 21, 2018
Messages
105
Office Version
  1. 2016
Platform
  1. Windows
hi All,

I want formula or macro that work on the following table and provide the value in column E. The macro should compare the sorted (a-z) value in column D and based on the value from the column C, it provide the below mentioned details in column E.

Column CColumn DColumn E
1PAPA1=2
2PAPA1=2
3TATA3=4
4TATA3=4
5TATA3=4
6FEAR6=7
7FEAR6=7
8MAMA8=9
9MAMA8=9
10MAMA8=9
11MAMA8=9
12GHMF12=13
13GHMF12=13

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Please help me with the code.

Thanks in advance.
 
Thank you Peter for your help.
You're welcome.

If interested, here is another macro that you could consider.
Code:
Sub JoinGroups()
  Dim c As Range
  Dim j As Long, lr As Long
  
  Set c = Range("D2")
  lr = Range("D" & Rows.Count).End(xlUp).Row
  Do Until c.Row > lr
    Do While c.Offset(j + 1).Value = c.Value
      j = j + 1
    Loop
    If j > 0 Then c.Offset(, 1).Resize(j + 1).Value = Join(Application.Transpose(c.Offset(, -1).Resize(j + 1).Value), "=")
    Set c = c.Offset(j + 1)
    j = 0
  Loop
End Sub
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,215,329
Messages
6,124,302
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top