Results 1 to 3 of 3

Thread: Need help converting formula into value in Excel

  1. #1
    Join Date
    Aug 2006
    Posts
    267

    Need help converting formula into value in Excel

    Hi friends, I know the easiest way is to copy and use paste special then "value" options. but is there a way to make it automated in case the desired output value has resulted.

    example:
    A1 B1 C1 D1
    1 2 A1+B1 Yes/No
    on the above example, if D1=Yes, the output C1 will become value equals to 3 and the formula will be remove, if D1=No, the formula will still remain.

    Thanks in advance for any help
    Intel E6300 Allendale 1.86 Ghz
    GigaByte GA 965P DS3 LGA 775
    Sapphire Radeon X1800XT 256MB
    Corsair XMS2 TWIN2X 2 x 1GB RAM
    Antec TruePower 2.0 TP-II 550 Watt

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Need help converting formula into value in Excel

    This can be done with a worksheet change event so whenever D1 changes the code will kick in

    code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$D$1" Then
    If Target = "Yes" Then
    Target.Offset(0, -1) = Range("A1") + Range("B1")
    Else
    Target.Offset(0, -1) = "=A1+B1"
    End If
    End If
    End Sub
    This can only be done manually, like you said by copy and pasting special values or with VBA.


    code:
    Sub Button2_Click()
    If Range("D1") = "Yes" Then
    Range("C1") = Range("A1") + Range("B1")
    Else
    Range("C1") = "=A1+B1"
    End If
    End Sub

  3. #3
    Join Date
    Aug 2006
    Posts
    267

    Re: Need help converting formula into value in Excel

    Thanks kelfro. i tried both tricks it works.
    Intel E6300 Allendale 1.86 Ghz
    GigaByte GA 965P DS3 LGA 775
    Sapphire Radeon X1800XT 256MB
    Corsair XMS2 TWIN2X 2 x 1GB RAM
    Antec TruePower 2.0 TP-II 550 Watt

Similar Threads

  1. Need formula help for MS Excel
    By RlyPlyPanda in forum MS Office Support
    Replies: 1
    Last Post: 08-05-2012, 01:46 PM
  2. Excel Formula
    By Scott2580 in forum MS Office Support
    Replies: 2
    Last Post: 15-02-2011, 02:21 PM
  3. Excel formula
    By Me Me Taylor in forum Windows Software
    Replies: 2
    Last Post: 06-04-2009, 04:11 PM
  4. Formula help in excel 2007
    By Muhammad Waqar in forum Windows Software
    Replies: 1
    Last Post: 24-11-2008, 07:29 PM
  5. Need help in excel formula
    By Landon in forum Software Development
    Replies: 2
    Last Post: 27-10-2008, 03:28 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
  •  
Page generated in 1,717,386,867.78330 seconds with 16 queries