Linking to PrevSheet using vlookup command

Paul Naylor

Board Regular
Joined
Sep 2, 2016
Messages
99
Office Version
  1. 365
  2. 2003 or older
Platform
  1. Windows
  2. Mobile
  3. Web
Hi . I'll start by saying i'm tying to do this in excel 97 , which were still using at work

Linking to previous worksheet. I've downloaded the following VBA code so instead of having to keep changing worksheet names in formula's I can use "PrevSheet" command , which does work, but having problems combining this with Vlookup

2 sets of data :

Sheet 1 ( Yesterday's date)
Job No ( Column A)
Previous Days Actions ( Column B)
Today's Actions ( Column C)

Sheet 2 ( Today's date)
Job No ( Column A)
Previous Days Actions ( Column B)
Today's Actions ( Column C)

Requirement: in sheet 2 ( today's) want to do a vlookup on job no. on previous sheet and if "True" display the result display the contents previous days actions ( column C) in today's column D, but if previous days actions is BLANK ( column c) , display previous days actions ( column B) and if that is BLANK display a text message "No previous actions".

Hoping someone can help.........


Function PrevSheet(RCell As Range)

Dim xIndex As Long
Application.Volatile
xIndex = RCell.Worksheet.Index
If xIndex > 1 Then _
PrevSheet = Worksheets(xIndex - 1).Range(RCell.Address)
End Function
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Futher to my earlier post , i've managed to get the following formula to work to display the results for 2 conditions i.e. previous actions and not on previous report , so now only need help to display results of a different cell if job no is on previous sheet , but no actions taken on previous sheet ( i.e. column c) want to display the results of the PevSheet Column B and if that BLANK display "no previous actions taken"

to display previous days actions :

=IFERROR(VLOOKUP($A2,PrevSheet($A:$c),3,0),"Not on Previous Report")

But also want to add 2 further conditions ....if job no (A2) if no the report but Previous Days Actions ( column C) is "BLANK" want to display PrevSheet ( Column B) and if that "BLANK" display "no previous actions taken"

Hoping someone can help....
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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