+ Reply to Thread
Results 1 to 12 of 12

Problem with entering formulas in data validation cells

  1. #1
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Problem with entering formulas in data validation cells

    I have two Excel problems, which are similar, so I've included them both in one post. I hope someone can help.

    =====

    Problem 1

    =====

    I have two sheets - Sheet A and Sheet B. In each sheet, there is a cell where a frequency can be entered (weekly, 2-weekly etc), and each cell contains a dropdown which refers to a list. When a frequency is chosen on Sheet A, I want the same frequency to auto-populate in Sheet B. So I tried using this formula in the cell in Sheet B:

    =IF(SHEET A!C4="","",SHEET A!C4)

    ...or I suppose I could just use:

    =(SHEET A!C4)

    Anyway, it wouldn't let me enter the formula, because of the data validation only allowing "weekly", "2-weekly" etc.

    So I tried creating the formula in another cell and referring to that cell instead:

    =IF(SHEET A!C4="",C4="",C4=SHEET A!C4)

    But using this formula doesn't auto-populate Sheet B C4 for me, it just returns "TRUE" or "FALSE" in the cell where this formula is entered.

    Is there any way I can get this to work, without removing the Data Validation from the cell (which I need to keep in place)?

    =====

    Problem 2

    =====

    I have two cells which I want to be populated automatically in SHEET A, using figures from SHEET B. One is a currency amount, and the other is a frequency ("weekly", "2-weekly" etc). So I use these formulas:

    =IF('SHEET B'!D22=0,"",TEXT('SHEET B'!D22,"£0.00")))
    =IF('SHEET B'!D22=0,"","monthly"))

    Formula #1 does work, but Formula #2 doesn't (I get the same problem as with Problem 1, where it won't let me enter the formula, because of the data validation). And it doesn't look great with only one formula working, because the cells are then only half-populated.

    So I tried the same alternative method as I tried with Problem 1, placing the formulas in alternative cells:

    =IF('SHEET B'!D22=0,B20="",B20=TEXT('SHEET B'!D22,"£0.00")))
    =IF('SHEET B'!D22=0,C20="",C20="monthly"))

    But again these just produce "TRUE" or "FALSE" in the formula cells, and nothing in the reference cells.

    =====

    So my problems seem to be:

    1 - I can't enter formulas in data validated-cells, even if the results of the formula are within the parameters of the data validation list (i.e. nothing at all, or something from the list)
    2 - I can't auto-populate a referenced cell by placing a formula in another cell somewhere else

    If I had a choice, I would actually prefer to have the formulas in other cells, because sometimes figures will be entered directly into the other cells, so it would make things look better if there were no formulas in the "main" cells".

  2. #2
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Problem with entering formulas in data validation cells

    If the same frequency needs to be on Sheet B that is entered on Sheet A then you really don't need the data validation on Sheet B.

    There really is no getting around the data validation. You set it up to allow certain values, yet trying to enter a formula in the cell goes against that validation, even if the result of the formula is a legitimate value for the validation.

    Perhaps if you upload a sample workbook a solution could be found for you.
    If I've been of help, please hit the star

  3. #3
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Problem with entering formulas in data validation cells

    Unfortunately I can't upload the workbook because it's not mine. But I can explain the situation.

    When someone enters a currency figure and selects a frequency on SHEET A (e.g. "£360" and "monthly"), the chances are that the frequency will need to be the same (in this case "monthly") on SHEET B. So I want the frequency cell on SHEET B to be automatically populated when a frequency is chosen on SHEET A. But I can't just make the frequency cell on SHEET B equal to the frequency on SHEET A, because there may be the odd occasion where the frequencies are different, and so I have to be able to allow the user to alter the frequency on SHEET B accordingly.

  4. #4
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Problem with entering formulas in data validation cells

    In your original post you stated "When a frequency is chosen on Sheet A, I want the same frequency to auto-populate in Sheet B.". But now it appears that's not always what you want.

    For the effort you'd need to go through to make this work as you describe in your second post, you may as well just leave the user to update both cells manually.

  5. #5
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Problem with entering formulas in data validation cells

    Well yeah, I do want the frequency to auto-populate, but I still need to give the user the opportunity to say "actually in this case, the frequencies are different", and then be able to modify the second frequency accordingly. That would be a very rare situation, but one I would have to allow for. But the vast majority of the time, the frequencies would be the same, which is why I wanted it to auto-populate. But it seems like it would be a lot of work to get that working.

  6. #6
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Problem with entering formulas in data validation cells

    It can be done, but for the sake of updating one cell I probably wouldn't bother.

    Have a look at the link below and scroll down to where it talks about "Conditional Data Validation"

    http://blog.contextures.com/archives...ta-validation/

  7. #7
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Problem with entering formulas in data validation cells

    If I could get it to work, then it would actually be auto-populating two cells, and when time is of the essence, that can help things. Especially because there will be another sheet, which if used, could auto-populate the figure, which would mean that up to four cells could be populated automatically. So I think it is worth the effort if I can get it to work.

    Thanks for the link, I'll give that I look and see if I can get it to work.

  8. #8
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Problem with entering formulas in data validation cells

    If I could get it to work, then it would actually be auto-populating two cells, and when time is of the essence, that can help things. Especially because there will be another sheet, which if used, could auto-populate the figure, which would mean that up to four cells could be populated automatically. So I think it is worth the effort if I can get it to work.

    Thanks for the link, I'll give that I look and see if I can get it to work.

  9. #9
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Problem with entering formulas in data validation cells

    Strange...I seem to have been able to enter "=SHEET A!C4" into the SHEET B cell, and this basically copies the frequency from SHEET A. The user can then alter the frequency in SHEET B should he need to, which would overwrite the formula, but the spreadsheet isn't saved anyway (a new one is opened each time), so losing the formula wouldn't be a problem.

    It's still slightly awkward because the SHEET B cell says "0" until a frequency is chosen on SHEET A.

    The problem is, I can't work out how I got the spreadsheet to accept the formula in the cell, because the data validation is still there, and so normally it won't accept any kind of formula. So I don't know how to apply it to the other cell. Does anyone know how I managed to do this?
    Last edited by ianpwilliams; 05-12-2013 at 06:51 AM.

  10. #10
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: Problem with entering formulas in data validation cells

    Why don't you get rid of the validation on sheet B and put a formula in there that feeds through from sheet A then if it needs to be altered you can just overwrite the formula with a value.

    If you used =IF(SHEETA!C4="","",SHEETA!C4) then you wont get the zero if C4 is empty.

    I'm sure there are many ways of making this more user friendly, but without sight of the file or an explanation as to why sometimes the values would be the same and sometimes not, it's hard to come up with something suitable.

  11. #11
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Problem with entering formulas in data validation cells

    Well one of the problems I'm working on is, a Gross Wage is entered on one sheet (amount in one cell, payment frequency in another), then the Tax and National Insurance amounts are entered on another sheet in the same way. I wanted to set it up so that as soon as a frequency is selected for the Gross Wage using a data validation pulldown, that same frequency is automatically completed for the Tax and NI on the other sheet.

    Now as much as I can't ever see there being a situation where the Gross Wage frequency would differ from the Tax or NI frequency, I still have to allow the user to do that, which prevents me from just saying "tax and NI frequency equals gross wage frequency".

    And if I get rid of the validation on the Tax and NI sheet, then it would work as long as the payment frequencies matched, but if they didn't, then the user would have to type the frequencies of the Tax and NI in manually, which wouldn't be ideal, because calculations are made based on the frequencies of various cells.

    I just thought it might be easier than this to, say, make the Tax and NI have their pulldowns, and let the default value of each pulldown be whatever the Gross Wage frequency pulldown is, and then the user would still be free to change the Tax and NI frequencies should they need to.

  12. #12
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: Problem with entering formulas in data validation cells

    Well I got it working in the end. If you remove the validation from the cell, and make sure it's formatted to General, then you can put whatever formula you want in the cell, and then add the data validation afterwards. This has allowed me to make sure the Tax and NI pulldowns match the Gross Wage pulldown, but still allows the user to change it should they wish to.

    Thanks for the help everyone
    Last edited by ianpwilliams; 05-12-2013 at 05:18 PM.

+ 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