How to pick up the last value in a column to use in a formula

chariot101

New Member
Joined
May 30, 2024
Messages
2
Office Version
  1. Prefer Not To Say
Platform
  1. MacOS
I've got a formula that needs to do a calculation that when column B has a certain value, then the value in column F needs to minus the previous value in column F. The problem is the previous value in column F isn't always on the previous row as if column B has a certain value then it's blank. I'm not sure on the best way to do this. At the moment I have:

=IF(NOT(B5="Get on"),F5-F4,"")

I think the easiest thing to do would be to add another IF statement to say IF B5 = Get on then F5 should equal F4 so it puts the previous value in F4 so the above calculation should be correct, but I can't get my head around how to do this. Or maybe there's a better solution?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
It's a little vague without example data
Try
IF(B5<>"Get on", F5-LOOKUP(2,1/(F$1:F4<>""),F$1:F4),"")

This
LOOKUP(2,1/(F$1:F4<>""),F$1:F4)
will find the last non blank value in column F up to F4
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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