+ Reply to Thread
Results 1 to 14 of 14

Conditional formatting adn data validation

  1. #1
    Registered User
    Join Date
    10-22-2015
    Location
    Lithuania
    MS-Off Ver
    2010
    Posts
    32

    Conditional formatting adn data validation

    Hello,

    Can you help me with conditional formatting formula?
    What I need to do is:

    If A1 is Text
    Then A2 cell is filled with red color and I can choose from data validation list.

    If A1 is not Text1 (something else)
    Then A2 is blank, no fill and no list from data validation

    Thank you!

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional formatting adn data validation

    As the conditional formatting formula use:

    =ISTEXT(A1)

    As the source for the drop down list use a formula like this:

    =IF(ISTEXT(A1),D1:D3,#N/A)

    Where D1:D3 are the selections available for the drop down list.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    10-22-2015
    Location
    Lithuania
    MS-Off Ver
    2010
    Posts
    32

    Re: Conditional formatting adn data validation

    Thank you for your answer.

    I am really sorry, but I don't understand where I should write these formulas. Do I have to write it in conditional formatting- manage rules - new rule- use a formula to determine which cells to format there is ,,format the value where this formula is true" ? But I can't write two formulas there, as you suggest.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional formatting adn data validation

    For the conditional formatting...

    Select cell A2

    Goto the Home tab>Styles>Conditional Formatting>
    Manage rules>New rule>Use a formula to determine
    which cells to format

    Enter this formula in the box below:

    =ISTEXT(A1)

    Click the Format button
    Select the desired style(s)
    OK out

    For the data validation...

    Select cell A2

    Goto the Data tab>Data Validation
    Allow: List
    Source: =IF(ISTEXT(A1),D1:D3,#N/A)

    Where D1:D3 (or whatever range you want to use) are the selections available for the drop down list.

  5. #5
    Registered User
    Join Date
    10-22-2015
    Location
    Lithuania
    MS-Off Ver
    2010
    Posts
    32

    Re: Conditional formatting adn data validation

    Thank you.

    I did everything like you told me, but there must be something wrong because it didn't work.
    ISTEXT checks if A1 value is text, but in my case A1 is always text, but I change it. I'll try to explain what I need again:

    If A1 is Apple
    Then A2 cell is filled with red color and I can choose from data validation list (jonagold, golden delicious, honeycrisp...)

    If A1 is not Apple (something else, for example - orange, banana, watermelon, etc.)(I change text in A1 manually)
    Then A2 is blank, no fill and no list from data validation

    Hope that is clear.

    What I get now, after using formulas you suggested - A2 is always red and with data validation list even when A1 is not ,,apple". What I need is for A2 to be red if A1 is apple and choose from list of types of apples and if A1 is banana, A2 is blank, without data validation...

  6. #6
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Conditional formatting adn data validation

    You need to amend Tony's instructions to check if A1=Apple instead of checking if A1 is text.

    First, select A2, then select 'Data Validation' on the 'Data' tab. Select 'List' and enter this:
    =IF(A1="Apple",$A$5:$A$9,#N/A)
    (replace $A$5:$A$9 with the range where your list is)
    Click OK - if A1 doesn't yet contain 'Apple', you will get an error message saying 'The Source currently evaluates to an error. Do you want to continue?' - click Yes.

    Now, with A2 still selected, click 'Conditional Formatting' on the 'Home' tab and select 'New Rule' then 'Use a formula to determine which cells to format'. Enter this formula:
    =C1="Apple"
    Click the 'Format' box and choose red fill.

    That should do what you want - here's a file with it working: CF and DV on drop-down list _ for JulijaKT.xlsx
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  7. #7
    Registered User
    Join Date
    10-22-2015
    Location
    Lithuania
    MS-Off Ver
    2010
    Posts
    32

    Re: Conditional formatting adn data validation

    Everything looks fine, except that:
    I write apple and choose Jonagold
    Then I write Banana (in A1) and A2 stays ,,Jonagold" - it should be blank...
    Is it possible to make it blank?

  8. #8
    Registered User
    Join Date
    10-22-2015
    Location
    Lithuania
    MS-Off Ver
    2010
    Posts
    32

    Re: Conditional formatting adn data validation

    Here is my file.

    It is not in english, but I don't have time to change everything. You can see that in B14 we have ,,ManoBustas Vadybininkas" (that's ,,apple"); in B15 I need data validation list, but I can see my formula, not list from sheet3, B3:B5.

    I am really really grateful for your help!

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional formatting adn data validation

    Quote Originally Posted by JulijaKT View Post
    Everything looks fine, except that:
    I write apple and choose Jonagold
    Then I write Banana (in A1) and A2 stays ,,Jonagold" - it should be blank...
    Is it possible to make it blank?
    That would require a VBA event macro.

    I'm not much of a programmer so someone else will need to help you with that.

  10. #10
    Registered User
    Join Date
    10-22-2015
    Location
    Lithuania
    MS-Off Ver
    2010
    Posts
    32

    Re: Conditional formatting adn data validation

    Thank you everyone for your help. We did our best and I guess I'll just have to delete unwanted text manually.
    I added reputation for eveyone who helped and closed this thread.

    Thanks again!

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional formatting adn data validation

    Thanks for the feedback!

  12. #12
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Conditional formatting adn data validation

    Sorry I haven't been on for a day or two - some wind damage at the house to deal with

    I've got it working for you, but it does need VBA as Tony said, so this will only work if macros are enabled.

    Open the VBA Editor by pressing Alt-F11, then right-click on 'Sheet1' and select 'View Code'. Paste in the code below.
    Please Login or Register  to view this content.
    This looks to see if cell B9 changes (which is what B14 looks up, which is what the drop-down in B15 checks). If B9 changes, it blanks B15.

    I'm not sure why the drop-down list was showing your formula instead of the correct list, but I re-did the data validation and it now seems to be working.

    Here's your file back - I think it now does what you want it to: 2015 11 09 lentele intranetui priėmimas _ with B15 clear macro _ AS.xlsm

  13. #13
    Registered User
    Join Date
    10-22-2015
    Location
    Lithuania
    MS-Off Ver
    2010
    Posts
    32

    Re: Conditional formatting adn data validation

    Thank you very much! I wasn't expecting any help after closing thread, but you did amazing job and I am very thankful! This did exactly what I needed. Thank you very much!

  14. #14
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Conditional formatting adn data validation

    You're welcome and thanks for the rep (again).

+ 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. Conditional Data Validation/Formatting
    By BWellman in forum Excel General
    Replies: 1
    Last Post: 03-30-2014, 02:30 AM
  2. conditional formatting/data validation?
    By 13lack13lade in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-17-2013, 10:47 PM
  3. Need help with data validation, conditional formatting combination and more...
    By IsiEMT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-13-2011, 11:34 PM
  4. data validation and conditional formatting
    By ennzo in forum Excel General
    Replies: 4
    Last Post: 12-05-2010, 07:51 PM
  5. Data Validation and Conditional Formatting using VBA
    By ABabeNChrist in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 01-30-2010, 03:53 AM
  6. Conditional Formatting/Data Validation?
    By 1230dc in forum Excel General
    Replies: 2
    Last Post: 10-07-2009, 05:38 AM
  7. Applying Conditional Formatting to Data Validation
    By kcstewart in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-28-2007, 06:46 PM

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