+ Reply to Thread
Results 1 to 19 of 19

Excel formatting formula help

Hybrid View

  1. #1
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Excel formatting formula help

    Hi Everyone!

    excelforumsample.xlsx

    I have a data set that I need help with. My data set has multiple iterations of the same number.

    As you'll find in the attachment for example:

    BA19, BA19-01, BA19-02 are all the same but I only need the latest iteration, in this case BA19-02.

    Ideally, I'd like a formula that just removes the other iterations (BA19 and BA19-01), but highlighting them works for now. Basically, if BA19 has BA19-01 check if there's is BA19-02 check if there is BA19-03, if false, else highlight BA19-02. Keep in mind not all items start with BA. I have over 7000 unique items.

    Some items won't have suffixes, so I need the formula to leaves the ones that don't be left alone. Also, the iterations sometimes go up to a -07.

    Is there a way to do this? Have a done a good job at explaining this? What else can I provide?

    Thank you,
    Wilson

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    Assuming that
    data starts in A2 going down,
    "-" occurs in suffix only (i.e values are all of the format abab-suffix and not ab-ab-suffix)

    Select data (A2:A1000) and conditional formatting>New rule>Formula
    Formula: copy to clipboard
    =MATCH("*"&MID(A2,1,FIND("-",A2&"-")-1)&"*", $A$1:$A1,0)
    format as you wish. See attachment
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    ChemistB,

    Thank you for the quick response. It worked just as you said. The only thing I was hoping it would do is only highlight the biggest iteration. For example: sometimes I have -01, -02,...-07.
    Your formula does this:
    a
    a-01
    a-02
    a-03
    a-04
    a-05


    I would like only:
    a
    a-01
    a-02
    a-03
    a-04
    a-05

    Is this possible?

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    Seems like there should be a shorter formula but

    Formula: copy to clipboard
    =AND(MATCH("*"&MID($A2,1,FIND("-",$A2&"-")-1)&"*", $A$1:$A1,0), ISERROR(MATCH("*"&MID(A2,1,FIND("-", $A2&"-")-1)&"*",$A3:$A$1000,0)))

    Does that work for you?

  5. #5
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    Almost ChemistB, man I really need to learn this so I don't bug you so much.

    Only thing that's missing is it needs to grab all the items with the last iteration.

    In this it did highlight the last iteration, but only one instance.

    Example:

    a-05
    a-05
    a-05
    a-05

    It needs to:

    a-04
    a-05
    a-05
    a-05


    Thanks again ChemistB!

  6. #6
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,656

    Re: Excel formatting formula help

    May be this?
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  7. #7
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    popipipo,

    Thank you. This doesn't work for me. If you look in my file that I shared, you might get a better idea. I don't know if there's a better way to explain it.

    ChemistB is pretty close to cracking the formula. The formula by ChemistB highlighted the biggest iteration, but only highlighted one instance, I need it to highlight all the biggest iteration of the items.

    BA19
    BA19-01
    BA19-01
    BA19-02
    BA19-02
    BA19-03
    BA19-03
    BA19-04
    ...
    BA19-07
    BA19-07
    BA19-07
    BA19-07


    I know I can formatted it myself, I'm just trying to make it obvious.

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    Are the values to the right of the "-" always a 2 digit number?

  9. #9
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    They are...

    Right I'm up to -07, but I imagine I will continue to have iterations. Like -08,-09...etc...

  10. #10
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    Okay, would this work....
    In an empty column (you can hide this later) enter the array formula (CNTRL SHFT ENTER if done properly, you'll see {} around formula)

    Formula: copy to clipboard
    =MAX(IF(MID($A$2:$A$1000, 1, FIND("-", $A$2:$A$1000&"-")-1)=MID($A2, 1, FIND("-", $A2&"-")-1), IFERROR(MID($A$2:$A$1000, FIND("-",$A$2:$A$1000&"-")+1,5)*1,0)))
    That formula pulls the maximum number for the base code in that row.
    Then in conditional formatting
    Formula: copy to clipboard
    =A2=LEFT(A2, FIND("-", A2&"-")-1)&TEXT(C2,"-00")
    See attachment
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    ChemistB,

    Can you run that formula on column B of excelforumsample.xlsx to see if you're getting the same issue I am? Your example is exactly what I need, but it doesn't work with the real data.

    I even went ahead and substituted column A in HighlightMultiplees.xlsx with excelforumsample.xlsx and I get the same issue.

    Thank you,

  12. #12
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,656

    Re: Excel formatting formula help

    This doesn't work for me
    I missed the first item (BA19 the one without '-') that you didn't named in #5

  13. #13
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    Here it is. I put the formula in Column T (again, you can hide that column). When you tried it, did you enter it with CNTRL SHFT ENTER? If you can't get it working, upload one that's not working and I'll tell you what's wrong.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    Quote Originally Posted by ChemistB View Post
    Here it is. I put the formula in Column T (again, you can hide that column). When you tried it, did you enter it with CNTRL SHFT ENTER? If you can't get it working, upload one that's not working and I'll tell you what's wrong.
    ChemistB,

    Thank you once again, you've spend some serious time doing this and it's helped my process of analyzing my data so much simpler. I left you a reputation comment.

    I was wondering if you know of any resources that you can send over to me so I can learn the basics of formulas like this. I like posting here, but sometimes it's nice knowing more than just vlookup. hahaha.

  15. #15
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    I have not seen a book that gets into this sort of convoluted formulas. Your best bet is to keep reading the board and pay particular attention to posts where you can imagine yourself running into an issue like the poster has. That's how I learned.

  16. #16
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    ChemistB,

    It worked well on the sample data but when I paste it to the full data set it doesn't catch the last item in the set of items specified. Could this be because I have over 1000 items. Total equals to 36,000+ rows.

    Also I don't know if it could be set to look up 50 rows and down 50 rows, due to the fact that there are so many rows it's taking a while to calculate.

    Thank you,

  17. #17
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    Attach a small example of what you are working with (Go Advanced>Manage Attachments). Yes, if you have a lot of data, Array formulas will slow you down quite a bit. Once I see how your data is set up, we can work around the arrayed formulas.

  18. #18
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel formatting formula help

    EXCELFORUM_11262013.xlsx

    I've only attached 100 items, again there are over 36K lines, if that makes any difference.

  19. #19
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formatting formula help

    This requires 3 dummy columns but should work a lot faster than the array solution I gave earlier.
    In your example, in U2 copied down
    Formula: copy to clipboard
    =IF(COUNTIF($U$1:U1,A2)>0,"", A2)

    In V2 copied down
    Formula: copy to clipboard
    =IF(LEN(U2)>1,IF(ISERROR(FIND("-",U2)),COUNTIF($U$2:$U$200, U2&"-*")+1, COUNTIF($U$2:$U$200, MID(U2,1, FIND("-",U2))&"*")+1),"")
    In W2 copied down
    Formula: copy to clipboard
    =IF(ISNUMBER(V2),IF(V2=1, "", MID(U2,1, FIND("-",U2&"-")-1)&TEXT(V2-1,"-00")),"")

    Then the conditional formatting rule is
    Formula: copy to clipboard
    =ISNUMBER(MATCH(A2,$W:$W,0))

    See attachment
    Attached Files Attached Files

+ 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. Replies: 8
    Last Post: 11-26-2013, 07:37 PM
  2. Can't figure out a formula for Conditional Formatting- Excel 2011
    By so_fistica_ted in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 5
    Last Post: 11-30-2012, 10:20 AM
  3. Need help with excel formula for conditional formatting
    By amateurtechie in forum Excel General
    Replies: 8
    Last Post: 01-10-2012, 03:28 AM
  4. Excel 2007/2010 Conditional/Formula Formatting multiple possible
    By ExcelNoob2008 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 06-16-2011, 11:41 AM
  5. [SOLVED] excel formula formatting result
    By lucho21 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-10-2006, 10:00 AM

Tags for this Thread

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