Leave only a Value after running a Formula

amerifax-heather

New Member
Joined
May 29, 2011
Messages
3
When running a Formula, is there anyway to just leave the value after the formula has been run. We are processing a very large data file and it is a huge operation just to copy and paste the value into another column and delete the original column with the formula.

This is an example of the formula:
=IF(COUNTIF(D:D,D2)>1,"X","")

When done we would like to be left with the Value-X and not the formula.

Thanks,

Heather
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi,

Just highlight the range you want to convert to values ==> ctrl c ==> right click ==> paste special ==> values ==> OK
 
Upvote 0
Hi,

Just highlight the range you want to convert to values ==> ctrl c ==> right click ==> paste special ==> values ==> OK

I believe she meant with in the calling formula. We are using the Ctr C etc but it can be cumbersome. We where hoping that the cell with the formula could end up ,after ran, with only the value instead of both formula and value.

Thanks
Bob
 
Upvote 0
Bob/Heather,

In that case a macro would probably be better suited.

If you can advise what column you are currently placing the formula in, then replacing with the output values (copy + paste) and then deleting, I or someone else on the board, could write a macro for you so you'd just need to run a single command/press a single button the macro is assigned to.

Jack
 
Upvote 0
Fair enough. Your code will probably be something like:
Code:
Sub FormulaToValue ()
 
Dim i As Long
 
With Application
    .ScreenUpdating = False
    .Calculation = xlCalculationManual
End With
 
i = Range("D" & Rows.Count).End(xlUp).Row
 
With Range("E1")
    .Formula = "=IF(COUNTIF(D1:D" & i & ",D2)>1,""X"","""")"
End With
 
With Range("E1:E" & i)
    .FillDown
    .Value = .Value
End With
 
With Application
    .ScreenUpdating = True
    .Calculation = xlCalculationAutomatic
End With
 
End Sub
 
Last edited:
Upvote 0
Or this - lots of different ways:
Code:
Sub FormulasToValues()
Dim i As Long
With Application
    .ScreenUpdating = False
    .Calculation = xlCalculationManual
End With
 
For i = 1 To Range("D" & Rows.Count).End(xlUp).Row
    If Range("D" & i) > 1 Then
        Range("E" & i) = "X"
    Else
        Range("E" & i) = ""
    End If
Next

With Application
    .ScreenUpdating = True
    .Calculation = xlCalculationAutomatic
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top