+ Reply to Thread
Results 1 to 21 of 21

Locking different values within cell depending if they are dragged vertically or horizonta

Hybrid View

Sonogan Locking different values... 06-30-2016, 09:48 AM
mikeTRON Re: Locking different values... 06-30-2016, 10:09 AM
peterrc Re: Locking different values... 06-30-2016, 10:13 AM
mikeTRON Re: Locking different values... 06-30-2016, 10:19 AM
mikeTRON Re: Locking different values... 06-30-2016, 10:21 AM
Sonogan Re: Locking different values... 06-30-2016, 06:58 PM
gak67 Re: Locking different values... 06-30-2016, 07:08 PM
gak67 Re: Locking different values... 06-30-2016, 07:17 PM
Sonogan Re: Locking different values... 06-30-2016, 07:26 PM
gak67 Re: Locking different values... 06-30-2016, 07:31 PM
Sonogan Re: Locking different values... 06-30-2016, 08:34 PM
gak67 Re: Locking different values... 06-30-2016, 08:56 PM
Sonogan Re: Locking different values... 06-30-2016, 09:30 PM
gak67 Re: Locking different values... 06-30-2016, 10:29 PM
Sonogan Re: Locking different values... 06-30-2016, 10:32 PM
gak67 Re: Locking different values... 06-30-2016, 10:38 PM
Sonogan Re: Locking different values... 06-30-2016, 10:42 PM
peterrc Re: Locking different values... 07-01-2016, 04:08 AM
Sonogan Re: Locking different values... 07-01-2016, 06:33 AM
peterrc Re: Locking different values... 07-01-2016, 07:05 AM
Sonogan Re: Locking different values... 07-01-2016, 07:31 AM
  1. #1
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Locking different values within cell depending if they are dragged vertically or horizonta

    Hello all

    I'm having difficulties figuring out a solution on how I can lock certain references within my formula depending upon whether I drag it along the row or down the column.

    As I drag the formula along the row I require this;
    =IF(FZ3=Import,VLOOKUP($A$8,'Edited Data'!$O$3:$P$3600,2,0),FZ3)

    But if I am to drag the formula down the column then I need this;
    =IF($F$Z3=Import,VLOOKUP(A8,'Edited Data'!$O$3:$P$3600,2,0),FZ3)

    The key differences of those two formulas being the IF function reference cell (FZ3) and the VLOOKUP reference cell (A8).


    Thanks!

    Martin
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    =IF(FZ$3=Import,VLOOKUP($A8,'Edited Data'!$O$3:$P$3600,2,0),FZ3)
    It seems like you could benefit from learning about absolute and relative references.
    http://www.gcflearnfree.org/excel201...-references/1/
    https://www.youtube.com/watch?v=NmVMjQzseLA
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Valued Forum Contributor
    Join Date
    05-11-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    586

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Hi,

    In your post you show $F$Z3, shouldn't this be $FZ$3 ?
    Either way, FZ shows figures not "Import"
    Are you able to attach a copy of your file so we can take a look?

    Regards

    peterrc

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  6. #6
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Hi


    In your post you show $F$Z3, shouldn't this be $FZ$3 ?
    Either way, FZ shows figures not "Import"


    $FZ$3 is correct, that typo arose from me editing in here here. I had manually gone through and changed the absolute and relative references but have realised that is ridiculous.
    "IMPORT" is a name box which is cell A1.
    I have no issues at all with absolute or relative references, in this formula they need to vary depending on whether they are dragged horizontally or vertically.

    A trimmed down version of the workbook is attached (size far exceeded limit). I am working in the sheet "Data Compilation". The formula is to reference the date of the data from sheet "Edited Data" match it to the corresponding date in the current sheet,
    then LOOKUP the corresponding Stock Exchange (ASX) code in column A and import the data.

    =IF(FZ3=Import,VLOOKUP($A$8,'Edited Data'!$O$3:$P$3600,2,0),FZ8) - A8 is the reference to the ASX code and needs to be absolute when dragging horizontally.
    =IF($FZ$3=Import,VLOOKUP(A9,'Edited Data'!$O$3:$P$3600,2,0),FZ9) - FZ3 is the reference to the current data date and needs to be absolute when dragging vertically

    Thank you.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Quote Originally Posted by Sonogan View Post
    I have no issues at all with absolute or relative references, in this formula they need to vary depending on whether they are dragged horizontally or vertically.
    As mikeTRON pointed out I think you need to learn some more about absolute and relative references, particularly about partially absolute references. His formula: =IF(FZ$3=Import,VLOOKUP($A8,'Edited Data'!$O$3:$P$3600,2,0),FZ3) will always look at row 3 for the IF logical test when dragged down, but will change columns when dragged across, but will always look at column A for the VLOOKUP value when you drag across, but will change rows when you drag down.
    Please add reputation by clicking on the * if I have helped.
    Please mark the thread SOLVED if your issue has been resolved.
    Thanks, Glenn.

  8. #8
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    The only thing I don't think mikeTRON got right is what will be returned if FZ3 does not equal Import, but that is because you haven't made that clear. Which cell are you wanting your example formula in, and what is to happen if FZ3 does not equal Import?

  9. #9
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Right ok, thanks for pointing that out.

    In the case of FZ3 not equally Import, then the cell value remains unchanged

    =IF(FZ$3=Import,VLOOKUP($A8,'Edited Data'!$O$3:$P$3600,2,0),FZ8


    Thanks for the assistance

  10. #10
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    You cant have that formula in cell FZ8, as that is a circular reference - a cell cannot refer to itself, or any other cell that refers to it. If the value is to equal the previous days value, unless FZ3 = Import, try: =IF(FZ$3=Import,VLOOKUP($A8,'Edited Data'!$O$3:$P$3600,2,0),FY8)

  11. #11
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Why can it not equal itself? If the IF function argument proves false then the value that is already in the cell remains unchanged (including a zero value). This part is critical as data imported from previous days isn't wiped when daily data is imported.

    Or can you see a better way to achieve that same outcome?

  12. #12
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    You cannot have both a value and a formula in the same cell. If you try it it will come up with a circular reference error. Where does the number that is in there to start with come from?

  13. #13
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    I can because I have and it works.

    Have you had a look inside the workbook? It somewhat difficult to explain thoroughly here; it references a list of sorted data on another sheet and inserts it for that day.
    All data from previous days is left untouched as the IF function is false and thus the cell equals its original value.

  14. #14
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Yes I have seen the workbook, and it warns me of a circular reference when I open it, and won't recalculate because of the circular references. Try double clicking on one of the formulas then hit enter and the value will change to a 0. I'm sorry to put it so bluntly, but you're wrong - it doesn't work.

  15. #15
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    I am aware of that and as everything is generated by macros, there is no requirement to click on the formula. In absence of a more bulletproof approach, this is working for me.

  16. #16
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    I was about to suggest that you update this via macros. If it works for you as it is, that's great, but as your original post talked about dragging formulas, I think you will run into calculation problems later when you do that.

  17. #17
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Completely agree - once the formula is in place, if I have to change it then I will be required to go back and import the data again for each day.

    Is there any other way you can see about getting around this?

  18. #18
    Valued Forum Contributor
    Join Date
    05-11-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    586

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    I agree with gak67, Post #14.
    The reason it "appears" to be working for you is because you have Calculation set to Manual.
    With Calculation set to Automatic, the result in FY8 is 0.
    If this is the wrong answer then there is a fault with the formula you are using.

    Regards

    peterrc

  19. #19
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Can you see a solution for this issue Peter? I'm stumped as to what else I can do....

  20. #20
    Valued Forum Contributor
    Join Date
    05-11-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    586

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    Hi Sonogan,

    I order to try and help I have a couple of questions:-

    1. In Modules 2 and 3 of your VBA code you have either a "Disable Autocalc" or a "Disengage Autoclac" macro.
    Why would you want to disable autocalc ?
    2. Are columns, FY:GC dependant on cell FZ3, or is only column FZ dependant on cell FZ3 ?

    Please advise.

    Regards

    peterrc

  21. #21
    Registered User
    Join Date
    06-30-2016
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    17

    Re: Locking different values within cell depending if they are dragged vertically or horiz

    I disable auto calculate as I am using importing data into another sheet, sorting it and then checking it prior to then importing it to my final sheet.

    Only column FZ is dependent on FZ3. Same goes for every other column (FY is dependent on FY3 etc)


    Thanks.

+ 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] Returning values from another sheet which works when dragged horizontally and vertically
    By letstuffhappen in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-06-2015, 01:22 PM
  2. Locking or Unlocking validated cells depending on the previous cell
    By biajw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2014, 11:36 AM
  3. Locking Panes Horizontially and Vertically
    By Rwilliams_09 in forum Excel General
    Replies: 7
    Last Post: 12-07-2012, 04:29 PM
  4. Locking cells depending on what is entered in another cell
    By nujwaan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-23-2009, 08:35 AM
  5. Replies: 0
    Last Post: 05-12-2006, 06:50 AM
  6. [SOLVED] Locking Data in a specific cell depending on selection of another
    By CrimsonPlague29 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2006, 06:10 AM
  7. Replies: 1
    Last Post: 07-27-2005, 11:04 PM

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