tag the comment based on criteria

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
200
Office Version
  1. 2013
Platform
  1. Windows

Book1
ABCDE
1IDCountryTime PeriodID+CountryComment
244Malaysia201344MalaysiaOld 2013
322Malaysia201322MalaysiaOld 2013
499Malaysia201399MalaysiaOld 2013
533Hong Kong201433Hong KongNew 2014
644Malaysia201444MalaysiaOld 2013
755Hong Kong201455Hong KongNew 2014
833Hong Kong201533Hong Kongold 2014
966China201566ChinaNew 2015
1033China201533ChinaNew 2015
1122Japan201622JapanNew 2016
1266Japan201666JapanNew 2016
1366China201666ChinaOld 2015
1422Japan201722JapanOld 2016
1555India201755IndiaNew 2017
1611India201711IndiaNew 2017
New Record




Column A has ID. Column B has Country Column C has time period column d has ID+ Country and Column E is the final output.


I want to update column E i.e. comments based on comparision of 2 time periods.For ex

(compare 2014 ID + Country with 2013 ID + Country. If ID+Country is not present in prior year then its "New 2014" else "Old 2013".


Criteria

Compare 2014 Vs 2013 If ID+Country in 2014 is not Present in 2013 then comment should be "New 2014" else "Old 2013"
or
Compare 2015 Vs 2014 If ID+Country in 2015 is not Present in 2014 then comment should be "New 2015" else "Old 2014"
or
Compare 2016 Vs 2015 If ID+Country in 2016 is not Present in 2015 then comment should be "New 2016" else "Old 2015"
or
Compare 2017 Vs 2016 If ID+Country in 2017 is not Present in 2016 then comment should be "New 2017" else "Old 2016"

for 2013 = "-"

let me know if you have any questions!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I think I understand correctly, and if I do then this should work. Copy E2 down as necessary. Note that your rows 2,3 and 4 should show "New 2013" according to your declared rule because there is no data for 2012, but I put in a condition that reports Old 2013 if the year is 2013.

E

<tbody>
[TD="align: center"]2[/TD]
[TD="bgcolor: #E2EFDA"]Old 2013[/TD]

</tbody>
Sheet35

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="width: 10, bgcolor: #DAE7F5"]E2[/TH]
[TD="align: left"]{=IF(C2=2013,"Old "&C2,IF(MAX((D2=$D$2:$D$16)*((C2-1)=$C$2:$C$16)),"Old "&C2-1,"New "&C2))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try to enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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