sorting data with colors

crazyamerican

New Member
Joined
May 26, 2010
Messages
10
All I need u r help with this problem.
i have two sheets one that has data and the other that displays data based on the color on the data sheet.
data sheet
screenshot006kj.jpg

result sheet
screenshot007oi.jpg


now i want the color associated with number on the data sheet to populate the result sheet with the corresponding suffix.

now next month i have some more data and if i copy it into the data sheet and press refresh i should be able to populate the results sheet with the colors associated with the latest date.
any help would greatly be appreciated.
Thanks In advance
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You'd have to use VBA to write a user-defined function (UDF) for this. So for this case:

Excel Workbook
ABCD
1namedate#1#2
2234-abs1/1/20111212
3246-one1/2/2011321.2
4345- hem1/3/20111213
5432-iss1/4/20116474
6234- iss1/5/20111561
7
8
9results
10nameabsiss
112342476
Sheet1


you'd use this VBA ( in a normal module ):
Code:
Function mysumbycolour(strPrefix As String, _
                    strSuffix As String, _
                    rngCriteria As Range, _
                    rngSumArea As Range)
    Application.Volatile
    Set myrange = Application.Caller
    mycolour = myrange.Interior.ColorIndex
    runningtot = 0
    For Each c In rngCriteria
        If c.Interior.ColorIndex = mycolour Then
            If Left(c.Value, Len(strPrefix)) = strPrefix And _
                Right(c.Value, Len(strSuffix)) = strSuffix Then
                For Each c2 In rngSumArea
                    If c2.Row = c.Row Then
                        runningtot = runningtot + c2.Value
                    End If
                Next
            End If
        End If
    Next
    mysumbycolour = runningtot
            
End Function
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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