Data cleaning

mira2020

New Member
Joined
Sep 25, 2020
Messages
27
Office Version
  1. 2016
hi ,

I have problem as below :

Data.PNG


Within each month, if same value cell in column A has different cell value in column B, it will change the cell value to column B .
Example, in sept, there are 4 cel in column A with value "Apple" but different cell value in column B . I want to change all these value to "High".
How to make it flexible such as if there is no "High", all values are "Medium" or "Low" then change to "Medium "

Here is the link to the file : Book2.xlsx

any idea ? Thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
try this,
Limitation, you have to select the range month-wise to get the month-wise result.

Put this code in a module, save the file as *.xlsm & use the formula shown below.

VBA Code:
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
'Updateby Extendoffice
Dim rng As Range
Dim xResult As String, xResultFinal As String
xResult = ""
For Each rng In pWorkRng
    If rng = pValue Then
        xResult = xResult & "," & rng.Offset(0, pIndex - 1)
                If InStr(xResult, "High") > 0 Then
                    xResultFinal = "High"
                 ElseIf InStr(xResult, "Medium") > 0 Then
                    xResultFinal = "Medium"
                 Else
                    xResultFinal = "Low"
                End If
    End If
Next
MYVLOOKUP = xResultFinal
End Function

mira2020-Data cleaning.xlsm
ABCDEFGHIJK
1FruitPriorityMonthFruitPriorityMonthResult
2AppleHighSeptAppleHighSeptHighselect the range for sept
3AppleHighSeptAppleHighSeptHigh
4OrangeLowSeptOrangeLowSeptLow
5BananaMediumSeptBananaMediumSeptMedium
6AppleLowSeptAppleHighSeptHigh
7AppleMediumSeptAppleHighSeptHigh
8OrangeHighOctOrangeHighOctHighselect the range for oct
9AppleHighOctAppleHighOctHigh
10OrangeLowOctOrangeHighOctHigh
11BananaMediumOctBananaMediumOctMedium
12AppleLowOctAppleHighOctHigh
Sheet1
Cell Formulas
RangeFormula
J2:J7J2=MYVLOOKUP(G2,$A$2:$C$7,2)
J8:J12J8=MYVLOOKUP(G8,$A$8:$C$12,2)
 
Upvote 0
Why don't you use 1, 2, and 3 as priorities and return the max per fruit per month?
 
Upvote 0
1601261902773.png


i am using formula in cell D2 : =MAX(IF(A2:A9=A2,IF(B2:B9=B3,C2:C9))) , but it get the max of the whole column, not filtered for apple and sept

thanks.
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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