Is there a way to use latest entered value in formula?

Chartist

Board Regular
Joined
Apr 2, 2007
Messages
138
Office Version
  1. 365
Platform
  1. Windows
I have prices from different vendors being entered in different columns. I need to select the last entered (updated) one for calculation. It can be from any column at random.

Currently I have to make the user copy paste that last entered value second time in another cell.

Surely there's a better way...? Thanks.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
The only other option I can think of is to have a short macro that would do the copy/paste automatically upon data entry without the user having to do it. If that works for you, what is the cell where the last entered value would go?
 
Upvote 0
The only other option I can think of is to have a short macro that would do the copy/paste automatically upon data entry without the user having to do it. If that works for you, what is the cell where the last entered value would go?
I think that will work.

Input data is in A1, B1 or C1.

The last cell entered is required in D1. Thanks.
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make an entry A1:C1 and press the RETURN key or TAB key.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A1:C1")) Is Nothing Then Exit Sub
    Range("D1") = Target
End Sub
 
Upvote 0
Solution
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make an entry A1:C1 and press the RETURN key or TAB key.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A1:C1")) Is Nothing Then Exit Sub
    Range("D1") = Target
End Sub
this is awesome! thanks. i really need to learn VBA fully now :)
 
Upvote 0

Forum statistics

Threads
1,214,412
Messages
6,119,365
Members
448,888
Latest member
Arle8907

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