macro to combine cell values with appended average of another cell

lenin

New Member
Joined
Jul 1, 2013
Messages
5
Have a table with 4 columns, Need a macro to combine some filtered cell with corresponding cell values are appended with combined values.
From
A B C D
111 Meeting 5.711% 12-May-13
222 Testing 3.711% 12-May-13
222 Meeting 4.711% 14-May-13
111 Testing 8.711% 17-May-13

To:
A B C D
Meeting 111[5.7%];222[4.7] 12-may-13 14-may-13
Testing 111[8.71];2223.71[] 12-May-13 17-May-13

Means If Value in column A appears more then once for a B value, then the appended value should be average of that C value.Image added: https://docs.google.com/file/d/0B7BtqzryKzJQRUUtNjVpal9Ib2s/edit?usp=sharing
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
To:
A B C D
Meeting 111[5.7%];222[4.7] 12-may-13 14-may-13
Testing 111[8.71];2223.71[] 12-May-13 17-May-13

is underlined bit correct?
 
Upvote 0
111Meeting5.71%12-May-13
222Testing3.71%12-May-13
222Meeting4.71%14-May-13
111Testing8.71%17-May-13
111Testing6.71%20-May-13
To:
A B C D
Meeting 111[5.7%];222[4.7] 12-may-13 14-may-13
Testing 111[8.71];222[3.71] 12-May-13 17-May-13
Meeting1115.71%<<<<<
Testing1117.71%
Meeting2224.71%
Testing2223.71%
indicated cell =SUMPRODUCT(($B$2:$B$6=$A15)*($A$2:$A$6=$B15)*($C$2:$C$6))/SUMPRODUCT(($B$2:$B$6=$A15)*($A$2:$A$6=$B15)*1)

<colgroup><col><col><col><col><col span="4"></colgroup><tbody>
</tbody>
not sure how to list the dates if say there were 27 testing 111 entries
 
Upvote 0
Hi,
I have using a macro, which did like follows.

If a Table has

Meeting XXX 111 5.71%
Testing XXX 222 3.71%
Meeting XXX 222 4.71%
Testing YYY 111 8.71%
Testing YYY 111 6.71%

After runs the macro:
Meeting XXX 111[0.0371];222[0.0471];222 5.71%
Testing YYY 111[0.0671];111 8.71%

Can you please help me to append the [5.71%] in first column and [8.71%] in second row. also the 5.71% auto converted as [0.0371], these need to prevented.
macro:
Sub Macro()
Dim lngRow As Long
For lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
If StrComp(Range("B" & lngRow), Range("B" & lngRow - 1), vbTextCompare) = 0 Then
If Range("C" & lngRow - 1) <> "" & ("D" & lngRow - 1) <> "" Then
Range("C" & lngRow - 1) = Range("C" & lngRow - 1) & "[" & Range("D" & lngRow) & "];" & Range("C" & lngRow)
End If
Rows(lngRow).Delete
End If
Next
End Sub

Thanks in Advance,
Lenin
 
Upvote 0
sorry - vba coding is beyond me - my solution gets you the info you need - you could then concatenate the cells to get them into your exact format
Meeting1115.71%222 4.71%
Testing1117.71%222 3.71%

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,009
Messages
6,128,258
Members
449,435
Latest member
Jahmia0616

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