+ Reply to Thread
Results 1 to 19 of 19

Replacing formula with $ variable cell reference

  1. #1
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Replacing formula with $ variable cell reference

    Hello,

    I would like to kindly ask you for help. I need to replace multiple formulas with $ variable cell references by another formulas with same $ variables cell references.
    If someone will be able to push me forward on how to, I will be then able to write VBA script to do it for all worksheets.

    I have workbook with multiple worksheets where in some rows are formulas, which I need to replace by another formulas:

    Sheet01
    A1 Value01
    A2 -
    A3 Value02
    A4 Value03
    A5 -
    A6 -
    A7 Value04
    ...
    B1 =VLOOKUP($A1,'Sheet 02'!$1:$1048576,2,FALSE)
    B2 some text
    B3 =VLOOKUP($A3,'Sheet 02'!$1:$1048576,2,FALSE)
    B4 =VLOOKUP($A4,'Sheet 02'!$1:$1048576,2,FALSE)
    B5 some text
    B6 some text
    B7 =VLOOKUP($A7,'Sheet 02'!$1:$1048576,2,FALSE)
    ...

    This works without any problem.

    Now I need to replace those formulas in column B to:

    B1 =IF(LOOKUP($A1,Sheet03!A1:A20000)=$A1,(VLOOKUP($A1,Sheet03$1:$1048576,2,FALSE)),(VLOOKUP($A1,'Sheet 02'!$1:$1048576,2,"FALSE")))
    B2 some text
    B3 =IF(LOOKUP($A3,Sheet03!A1:A20000)=$A3,(VLOOKUP($A3,Sheet03$1:$1048576,2,FALSE)),(VLOOKUP($A3,'Sheet 02'!$1:$1048576,2,"FALSE")))
    B4 =IF(LOOKUP($A4,Sheet03!A1:A20000)=$A4,(VLOOKUP($A4,Sheet03$1:$1048576,2,FALSE)),(VLOOKUP($A4,'Sheet 02'!$1:$1048576,2,"FALSE")))
    B5 some text
    B6 some text
    B7 =IF(LOOKUP($A7,Sheet03!A1:A20000)=$A7,(VLOOKUP($A7,Sheet03$1:$1048576,2,FALSE)),(VLOOKUP($A7,'Sheet 02'!$1:$1048576,2,"FALSE")))
    ...

    So in general: find any formula in column B and replace it by another formula, while keeping $ variable cell reference for respective row.
    Note: there is one $ variable cell reference in current formula. Same $ variable cell reference occurs 4x in new formula!

    Would you be able to help, please?
    To replace about 3.000 formulas manually would kill me.

    Thanks in advance for any helpful tip.
    PQK
    Last edited by PQK78; 07-16-2015 at 10:51 AM.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    So basically all the formulas use only the Column A?
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    Yes. Cell reference values are every time in column A and formulas are in column B. Each cell reference use its row in column A.

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    So can you not use Ctrl+H and Find "A" and Replace with "$A"?

    Or is it that you want to replace the whole formula?

  5. #5
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    Yes, I want to replace whole formula. As described in original post. :-)

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    You can enter the converted formula manually once in Cell B1 and drag it down.

    If you have Text in between and hence do not want to do this, then

    Select the data from Column B > F5 > Alt+S > F > Enter (This will selects only those cells with Formulas) > enter the converted formula manually once in Cell B1 and commit using Ctrl+Enter instead of Just Enter

    Let me know if that works for you

  7. #7
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    Yes. This works!

    Unfortunately I found another issue. B column does contain also another formulas, which I do not want to change. So column B looks like this?

    B1 =VLOOKUP($A1,'Sheet 02'!$1:$1048576,2,FALSE)
    B2 some text
    B3 =VLOOKUP($A3,'Sheet 02'!$1:$1048576,2,FALSE)
    B4 =VLOOKUP($A4,'Sheet 02'!$1:$1048576,2,FALSE)
    B5 = another formula I don't would like to change
    B6 some text
    B7 =VLOOKUP($A7,'Sheet 02'!$1:$1048576,2,FALSE)
    B8 =VLOOKUP($A8,'Sheet 02'!$1:$1048576,2,FALSE)
    B9 = another formula I don't would like to change
    B10 = another formula I don't would like to change
    B11 =VLOOKUP($A11,'Sheet 02'!$1:$1048576,2,FALSE)
    B12 = some text
    ...

    So I need to select only some formulas. If it can be helpful: other formulas does not contain strings like: FALSE or VLOOKUP or Sheet 02

  8. #8
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    Alright!

    Is there any commonality which can help you filter (Using Autofilter) only those cells with formulas?

  9. #9
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    Yes.
    - Formulas to be changed are: >> =VLOOKUP($A3,'Sheet 02'!$1:$1048576,2,FALSE) << where $A3 is cell reference variable.
    - Formulas to be not changed are: >> =IF(Sheet03!$B$3>0,Sheet03!$B$3,Sheet03!$A$3) <<

    So other formulas which should not be changed does not contain strings like: FALSE or VLOOKUP or Sheet 02

  10. #10
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    Which version of excel are you using?

  11. #11
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    MS Office Professional Plus 2010

  12. #12
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    Can you attach your sample workbook?

  13. #13
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference


  14. #14
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    Here we go.
    Attachment 407085

  15. #15
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    Here!

    Put this in cell C8 and drag down

    =IFERROR(IF(A8<>"",VLOOKUP(A8,Translations!$A$24:$B$29,2,0),""),"")

  16. #16
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    I'm not sure if I wrote something wrong. :-)

    I do not need change values - I need to change "formulas"!
    So change formula in B8, B13, B17, B22, B25 to the formulas which are in B31, B36, B40, B45, B48.

  17. #17
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    I am sorry, I got confused between 2 threads..

    Try this -

    Select A7:B25 > Ctrl+Shift+L for Auto Filter > From A Column Uncheck Cislo & Blanks from the Filter > Copy Cell B31 & On Cell B8 Hit Enter to paste > Select All Entries except headers from B Column > B8 Being the activecell, click in the Formula Bar & Commit using Ctrl+Enter.

    Then you can remove the autofilter.

  18. #18
    Registered User
    Join Date
    07-14-2015
    Location
    Prague
    MS-Off Ver
    2010 Pro
    Posts
    10

    Re: Replacing formula with $ variable cell reference

    Perfect. Now I just need to convert it to VBA. :-)
    Thanks for help.

  19. #19
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Replacing formula with $ variable cell reference

    Glad it helped!

+ 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. Replacing strings/ replacing numbers and letters
    By Insert Name in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2015, 01:15 PM
  2. IF function: Using text in logical_test with multiple variables and replacing with text
    By SarahRachelJones in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-25-2012, 02:17 PM
  3. Deleting formula and replacing with value
    By jhannes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2012, 06:48 PM
  4. Replacing cell value without replacing formula in the cell
    By kingoftheace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-17-2012, 06:28 AM
  5. Help with replacing text with formula
    By dan96max in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2009, 10:57 AM
  6. replacing formula with result?
    By francisos in forum Excel General
    Replies: 4
    Last Post: 11-25-2008, 10:15 AM
  7. Replacing info mid formula
    By dagindi in forum Excel General
    Replies: 1
    Last Post: 06-02-2008, 03:26 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