+ Reply to Thread
Results 1 to 15 of 15

Complex Conditional Formatting formula help

  1. #1
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Complex Conditional Formatting formula help

    I'm trying to do some conditional formatting to find the first order of a customer. Our information is the order date and the customer number. We have more information than that available, but don't feel like generating it or exposing our customers.

    Right now I have =OR(AND($B2=$B3,$A2=$A3)) but it's incomplete and nonfunctional. It never highlights the last order either since the last order's orderdate doesn't match the next. It should be highlighted though. Can't figure out how to do that.

    What we're trying to find out is what returning customers bought in their first order that caused them to return to our website to buy more. Trying to find whether or not new customers get more advertisement than returning customers amongst other metrics we could measure with this information.

    Any ideas?
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Complex Conditional Formatting formula help

    Maybe this:

    =AND(COUNTIF(A$1:A1,A2), COUNTIF(B$1:B1,B2))

  3. #3
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Re: Complex Conditional Formatting formula help

    Almost works. Doesn't highlight the whole row. Is there a good tutorial around that talks about how to use these things? I never know where to put the dollar signs.

    Also doesn't highlight the first order of a returning customer, and never highlights the first row of that order.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Complex Conditional Formatting formula help

    Sorry.. This maybe:

    =AND(COUNTIF($A$1:$A1, $A2), COUNTIF($B$1:$B1, $B2))

    Yes.. Higlight 2nd and every other order.. In another name: duplicates...

    I guess I wasn't focused.
    Last edited by zbor; 08-24-2010 at 10:24 AM.

  5. #5
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Re: Complex Conditional Formatting formula help

    Hmm, highlights the whole row, but does the same thing.

    What does this say in english,

    Count how many times A2 appears in A1 and how many times B2 appears in B1. If both values are 1, then its true.

    Can't even figure out the pseudocode, and the pseudocode interpretation I wrote there doesn't include the dollar signs which must have some meaning.

    And still doesn't highlight first row of a customer's order.

    Thanks for your help on this, Zbor.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Complex Conditional Formatting formula help

    Try this:

    Select columns A and B then apply conditional formatting with this formula

    =($A1=MIN(IF($B$1:$B$1000=$B1,$A$1:$A$1000)))*($A1<>"")

    This will work for data down to row 1000, adjust as required
    Audere est facere

  7. #7
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Re: Complex Conditional Formatting formula help

    It works, though I can't interpret why.

  8. #8
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Re: Complex Conditional Formatting formula help

    The first part, $A1=MIN is comparing the first column to the lowest value of the A column only if the B column value is equal to .... B1? Then we multiply by a boolean 1-0 depending on whether A1 is null or not.

    I feel like I"m really missing something with not understanding these dollar signs.

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Complex Conditional Formatting formula help

    Yes, this part....

    =MIN(IF($B$1:$B$1000=$B1,$A$1:$A$1000))

    finds the smallest date associated with the ID in B1. If A1 is that date (or one of those dates), it'll be highlighted. As you want to highlight both columns all the column letters have preceding $ signs so that the formula doesn't change from column A to B......also we don't want the ranges A1:A1000 and B1:B1000 to change, the only part that should is the $B1, no $ sign before the row number because that should change down the column to compare against the specific ID for each row.

    When I tested I realised that my initial formula would also highlight blank rows so I added the ($A1<>"") part to prevent that. Some people prefer to use AND, i.e.

    =AND($A1=MIN(IF($B$1:$B$1000=$B1,$A$1:$A$1000)),$A1<>"")

    That will work just the same

  10. #10
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Re: Complex Conditional Formatting formula help

    So dollar signs mark absolute references versus relative?

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Complex Conditional Formatting formula help

    Sorry, yes, I didn't say that explicitly.

    With conditional formatting you need to remember that the formula given applies to the top left cell in the range selected (in this case A1) and that the formula will adjust for each cell in the range the same way it would if you put it in a cell and copied it down the column. In this case then B1 will have the same formula as A1 but A2 will change to

    =($A2=MIN(IF($B$1:$B$1000=$B2,$A$1:$A$1000)))*($A2<>"")

    ...and the same way all the way down the column....

  12. #12
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Re: Complex Conditional Formatting formula help

    One more question for you, which might be harder, not sure. I was hoping to find customers that have more than one order, or in other words, more than one OrderDate.

    Right now, I know i have to use frequency in a third part of the AND statement, but can't figure out how to pull and count frequency of only the date range of the customer, and not the whole date range.

    I also only wanted to do this for the values we had already checked, so I did this:

    =AND($A1=MIN(IF($B$1:$B$48050=$B1,$A$1:$A$48050)),$A1<>"",IF(1=IF($B$1:$B$48050=$B1,1),IF(FREQUENCY($A1: )>1,1))

    And you can see where I'm stuck inside the Frequency formula. I know I need relative values, but not sure if this is possible.
    Last edited by sean.tapscott; 08-24-2010 at 12:05 PM. Reason: my :) turned into a smiley face, so I added a space

  13. #13
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Complex Conditional Formatting formula help

    So you still want to highlight the first order for each customer......but only if there are subsequent orders for that customer? Try like this

    =AND($A1=MIN(IF($B$1:$B$1000=$B1,$A$1:$A$1000)),SUM(($B$1:$B$1000=$B1)*($A$1:$A$1000<>$A1))>0)

  14. #14
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Complex Conditional Formatting formula help

    Quote Originally Posted by sean.tapscott View Post
    Is there a good tutorial around that talks about how to use these things? I never know where to put the dollar signs.
    Try youtube: http://www.youtube.com/watch?v=NmVMjQzseLA

  15. #15
    Registered User
    Join Date
    08-24-2010
    Location
    Not necessary
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    8

    Re: Complex Conditional Formatting formula help

    Cool. Thanks, Zbor. BTW daddylonglegs, the last formula worked perfectly, as I'm sure you're confident of.

    Now, hopefully this won't just be a waste of time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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