Not sure what function to use - INDEX/MATCH, VLOOKUP?

brasqo

New Member
Joined
Jul 10, 2019
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Just looking for some guidance...

I'm confused on what I should be looking for as far as what formula would accomplish what I'm looking to do.

Capture.PNG


I'd like to be able to look at column H, and if it has text rather than a date, I'd like to change it to the date... You can see in Column A, these are the same case number (78972), but I have Labor and Parts are on separate lines. For some reason, when I'm pulling parts from my proprietary program, it doesn't pull a date as needed.

So in this case, I'm looking to create a formula that will look at column A, and if the value in column H is not equal to a date, then copy the date in the corresponding (same case number) in it's place...

So in this example, I'd want to copy "12/7/2021 21:34" from H1, and copy it to H2 - replacing the "Village- HVAC..." text....The sheet im working on has alot of instances like this, so I'll be applying this formula/macro to the entire sheet.

I looked at some methods using VLOOKUP, but that would require me to create all of this data into a table (it's pretty substantial amount of data - over 300 rows).

Would this be a case for INDEX/MATCH?

If anyone can point me in the right direction, it would be extremely appreciated.

Thank you as always!
 

Attachments

  • Capture.PNG
    Capture.PNG
    7 KB · Views: 7

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi,

If the Labor row is Always ahead of the Parts row, this can do the job.
The formula will have to be in a separate Column, Not column H, if you want the values changed within column H, you'll need VBA.

Book3.xlsx
ABCDEFGHI
17897212/7/2021 21:3412/7/21 21:34
278972Village -HVAC12/7/21 21:34
Sheet996
Cell Formulas
RangeFormula
I1:I2I1=IF(N(H1),H1,VLOOKUP(A1,A$1:H1,8,0))
 
Upvote 0
Solution
Thank you for looking jtakw!

I ended up using the following in VBA, and it worked as needed!!!.

VBA Code:
Sub Change_Completed_Date_Parts()

'S = column I want the result posted.
Range("S1").Formula = "=IF(N(H1),H1,VLOOKUP(A1,A$1:H1,8,0))"
Range("S1", "S" & Cells(Rows.Count, 1).End(xlUp).Row).FillDown

End Sub

Thank you again!
 
Upvote 0
You're welcome, thanks for the feedback, glad you worked it out.
 
Upvote 0

Forum statistics

Threads
1,213,517
Messages
6,114,085
Members
448,548
Latest member
harryls

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