+ Reply to Thread
Results 1 to 11 of 11

Checking a single cell for multiple values

  1. #1
    Registered User
    Join Date
    11-12-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2007
    Posts
    7

    Checking a single cell for multiple values

    Hi,
    This is my first post, so apologies if I miss anything or what I'm after isn't very clear.

    I'm trying to validate the data entered into a series of cells each cell can contain a different set of data but the value N/A is also permitted. For example:

    Cell A1 could contain a date from 2013-01-01 thru 2013-12-01 but the value N/A is also valid
    Cell A2 could contain a decimal from 0.01 thru 302502.23 but the value N/A is also valid
    Cell A3 could contain an integer from 3 thru to 9000 but the value N/A is also valid

    When the acceptable values are entered then I want to be able to carry on otherwise I want to pop up with an error.

    Hope that makes sense and any help much appreciated.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Checking a single cell for multiple values

    welcome to the forum. go to Data -> Data Validation -> Allow: Custom -> Formula:
    for A1
    =OR(AND(A1>=--"1jan2013",A1<=--"1dec2013"),A1="N/A")

    for A2:
    =OR(AND(A2>=0.01,A2<=302502.23),A2="N/A")

    for A3:
    =OR(AND(A3>=3,A3<=9000),A3="N/A")

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    11-12-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Checking a single cell for multiple values

    Perfect, many thanks this works an absolute treat

  4. #4
    Registered User
    Join Date
    11-12-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Checking a single cell for multiple values

    Hi,
    In addition to the previous request around the validation my user has now come back with something else. If a user enters a decimal into a field that is only expecting an integer then they want it to error rather than rounding as it does currently.

    Is there a way I can do this and also incorporate the validation above.

    Thanks in advance

  5. #5
    Registered User
    Join Date
    11-12-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Checking a single cell for multiple values

    Quote Originally Posted by xxchurch View Post
    Hi,
    In addition to the previous request around the validation my user has now come back with something else. If a user enters a decimal into a field that is only expecting an integer then they want it to error rather than rounding as it does currently.

    Is there a way I can do this and also incorporate the validation above.

    Thanks in advance

    I managed to sort out the above issue with the following:

    =OR(AND(C47>=0,C47<=900,INT(C47)=C47),C47="N/A")

    However, I now have another variation to cater for. I need to be able to check that where only 2 decimal places are allowed in a cell that the user has not entered more than the 2. This is in addition to also being able to check the upper and lower boundaries and the presence of N/A too.

    Really appreciate any help.

    Thanks

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Checking a single cell for multiple values

    for only integers you could use in A3

    =OR(AND(A3>=3,A3<=9000,SUM(--(ISNUMBER(SEARCH(".",A3))))=0),A3="N/A")

    for decimal criteria use in A2
    =OR(AND(A2>=0.01,A2<=302502.23,LEN(A2)-SEARCH(".",A2)=2),A2="N/A")
    Last edited by hemesh; 01-27-2014 at 08:17 AM.
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  7. #7
    Registered User
    Join Date
    11-12-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Checking a single cell for multiple values

    I think I have the only integers working as per the code in my earlier post. The problem I'm having is combining checking upper and lower boundaries, with N/A and also being able to validate that only 2 decimal places have been entered.

  8. #8
    Registered User
    Join Date
    11-12-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Checking a single cell for multiple values

    Quote Originally Posted by hemesh View Post
    for only integers you could use in A3

    =OR(AND(A3>=3,A3<=9000,SUM(--(ISNUMBER(SEARCH(".",A3))))=0),A3="N/A")

    for decimal criteria use in A2
    =OR(AND(A2>=0.01,A2<=302502.23,LEN(A2)-SEARCH(".",A2)=2),A2="N/A")
    Thanks for the above response. the integer check is working perfectly, however the decimal check is not recognising N/A as a valid entry.

    Any ideas?

    Thanks

  9. #9
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Checking a single cell for multiple values

    Hello xxchurch try this =OR(AND(A2>=0.01,A2<=302502.23,ISNUMBER(LEN(A2)-SEARCH(".",A2)=2)),A2="N/A")

  10. #10
    Registered User
    Join Date
    11-12-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Checking a single cell for multiple values

    Quote Originally Posted by hemesh View Post
    Hello xxchurch try this =OR(AND(A2>=0.01,A2<=302502.23,ISNUMBER(LEN(A2)-SEARCH(".",A2)=2)),A2="N/A")
    Hi,
    Really appreciate you taking the time to help me out. I can't get the example above working at all, the N/A validation works but the decimal place and boundary checking just errors each time even when a valid number is entered. The example below:

    =OR(AND(A2>=0.01,A2<=302502.23,LEN(A2)-SEARCH(".",A2)=2),A2="N/A")

    was doing all of the boundary and decimal place checking perfectly but the N/A check wasn't working, so it was really close. Does it make a difference if I have the cell set as General or Number?

    Thanks in advance

  11. #11
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Checking a single cell for multiple values

    hi there. you should actually start a new thread for a new question/criteria. but just this time round, try:
    =OR(AND(A2>=0.01,A2<=302502.23,IF(ISNUMBER(A2),TRUNC(A2,2)=A2)),A2="N/A")

    do mark the thread as Solved if that answers your question

+ 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. [SOLVED] How to return multiple values to a single cell based on multiple criteria
    By lwallace in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-20-2014, 06:32 AM
  2. [SOLVED] HELP: Need to separate values from a single cell with multiple values
    By MrBrownGuy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-24-2013, 07:46 AM
  3. Checking for single value, returning Multiple values
    By English_Bloke82 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2013, 01:31 PM
  4. Sum values from multiple cells - multiple lookup values in single cell
    By taxdept in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-21-2012, 04:12 PM
  5. Replies: 2
    Last Post: 02-20-2012, 06:06 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