+ Reply to Thread
Results 1 to 6 of 6

Checking equality with previous data

  1. #1
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Checking equality with previous data

    Hello,

    I am trying to come up with a formula for Conditional Formatting.

    I have a data of
    Column A: Plate Numbers
    Column B: Number of how many times they've moved, and
    Column C: the reason for movement.

    I've attached an example file.

    If you look at the 12th row, you will see CRT240's 3rd movement is "Repair". If the same car's previous movement (2nd in this case) is also "Repair", I need C12 highlighted.

    I only need to check "Repair". Other movements are irrelevant.

    Formatting will be applied to entire column, so the formula needs to be as short and clean as possible.

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: Checking equality with previous data

    Please try Conditional Formatting applies to C2:Cxx

    =SEARCH("repair*repair",LOOKUP(2,1/($A$1:$A1=$A2),$C$1:$C1)&C2)
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Re: Checking equality with previous data

    I can't even begin to understand the logic behind the formula, but it works! Thanks so much

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: Checking equality with previous data

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Checking equality with previous data

    Mgc26133,

    Try the attached.

    Rather than needing the whole Column, Col C is a 'dynamic' range (MOVEMENT) so the CF is applied only to rows with data, and expands automatically as you add new entries.

    Cols K and L are also "dynamic" ranges, listing the Unique values in Cols A and B. They fill the DropLists in E2 and F2. So if you add a new vehicle to Col K. or another Category of work to Col L, they are added automatically in the DropLists.

    Select a vehicle from E2 and the Work from F2. If there is a second instance, the cell in Col C fills.

    CF formula is as follows:
    =IF(A2=E$2,COUNTIFS($A$2:$A2,E$2,$C$2:$C2,$F$2))=2

    (For each row in Col A with data, if the registration is what you selected in E2, count how many records up to that row are for that vehicle where the work is whatever you selected in F2. If this is the second instance, fill the cell)
    If you want to look for a different frequency at any time (e.g. a third instance), just change the number at the end from =2 to =(whatever).

    Ochimus
    Attached Files Attached Files
    Last edited by Ochimus; 12-09-2020 at 02:06 PM.

  6. #6
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Re: Checking equality with previous data

    Quote Originally Posted by Ochimus View Post
    Mgc26133,

    Try the attached.

    Rather than needing the whole Column, Col C is a 'dynamic' range (MOVEMENT) so the CF is applied only to rows with data, and expands automatically as you add new entries.

    Cols K and L are also "dynamic" ranges, listing the Unique values in Cols A and B. They fill the DropLists in E2 and F2. So if you add a new vehicle to Col K. or another Category of work to Col L, they are added automatically in the DropLists.

    Select a vehicle from E2 and the Work from F2. If there is a second instance, the cell in Col C fills.

    CF formula is as follows:
    =IF(A2=E$2,COUNTIFS($A$2:$A2,E$2,$C$2:$C2,$F$2))=2

    (For each row in Col A with data, if the registration is what you selected in E2, count how many records up to that row are for that vehicle where the work is whatever you selected in F2. If this is the second instance, fill the cell)
    If you want to look for a different frequency at any time (e.g. a third instance), just change the number at the end from =2 to =(whatever).

    Ochimus
    It seems that it would require me to check each plate number individually. That is not practical, the original list has thousands of unique plate numbers and other datas, full data currently nearing 100k rows and more being added every day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. count equality between two columns
    By pedersenn in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-10-2016, 11:24 PM
  2. [SOLVED] Checking previous dates
    By RJL3313 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-05-2015, 02:08 PM
  3. Using SUMIF to compare two cells for equality and then sum if there is a match
    By methuselah90 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-28-2014, 05:56 AM
  4. [SOLVED] Equality of a range and a double variable in VBA
    By Haleh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2014, 08:08 AM
  5. Replies: 1
    Last Post: 12-05-2011, 12:58 PM
  6. Idenitifying row which matches equality condition
    By axecel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2010, 12:03 PM
  7. How do I calculate the Root Mean Square (RMS) of line of equality
    By aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa in forum Excel General
    Replies: 1
    Last Post: 06-23-2005, 08:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1