Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2022, 01:48 PM
tispivey tispivey is offline Formula help Windows 11 Formula help Office 2021
Novice
Formula help
 
Join Date: Mar 2022
Posts: 4
tispivey is on a distinguished road
Default Formula help

Hello all,



I have a couple issues I need help with. I am attempting to populate data into Column D and G in the attached spreadsheet.

The formulas I have, pulls the code from A, compares it to H, and returns what is in I into C. When I attempt to pull the rows that have multiple codes, and populate into D, it gives me an error because there are spaces at the end of the code in A. If I manually remove them, it works, but when I attempt to add TRIM, it doesn't do anything, so I get an error.

The same thing is happening when I attempt to do the same for column G for the ones with three codes. There are a couple in row B that have 4 different codes that I am going to work on that once I get this under control.

Any help you all can provide would be greatly appreciated.
Attached Files
File Type: xlsx Test1234.xlsx (115.9 KB, 11 views)
Reply With Quote
  #2  
Old 03-30-2022, 11:47 PM
ArviLaanemets ArviLaanemets is offline Formula help Windows 8 Formula help Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

Into D2 enter formula
Code:
=IFERROR(VLOOKUP(MID((SUBSTITUTE($A2," ","")),3,2),$H:$I,2,0),"")
and copy down!

Use SUBSTITUTE in 2nd formula too!
Reply With Quote
  #3  
Old 03-31-2022, 12:54 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Formula help Windows 7 64bit Formula help Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,771
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

I don't see why the SUBSTITUTE in col D is necessary
Code:
=VLOOKUP(MID(A60,3,2),H:I,2)
does the job


@tispivey


Using entire columns as reference is bad practice
Use Excel Tables instead as dynamic reference

As for the IFERROR function, do not apply it before you have ascertained that your formula works correctly
In this case if you want to hide the NA error, OK, but suppose, for some reason, it returns a VALUE error? IFERROR will hide that also leading to incorrect results
IMO the ISNA function is safer
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #4  
Old 03-31-2022, 06:27 AM
tispivey tispivey is offline Formula help Windows 11 Formula help Office 2021
Novice
Formula help
 
Join Date: Mar 2022
Posts: 4
tispivey is on a distinguished road
Default

Quote:
Originally Posted by ArviLaanemets View Post
Into D2 enter formula
Code:
=IFERROR(VLOOKUP(MID((SUBSTITUTE($A2," ","")),3,2),$H:$I,2,0),"")
and copy down!

Use SUBSTITUTE in 2nd formula too!
That worked! Thank you!
Reply With Quote
  #5  
Old 03-31-2022, 06:28 AM
tispivey tispivey is offline Formula help Windows 11 Formula help Office 2021
Novice
Formula help
 
Join Date: Mar 2022
Posts: 4
tispivey is on a distinguished road
Default

Quote:
Originally Posted by Pecoflyer View Post
I don't see why the SUBSTITUTE in col D is necessary
Code:
=VLOOKUP(MID(A60,3,2),H:I,2)
does the job


@tispivey


Using entire columns as reference is bad practice
Use Excel Tables instead as dynamic reference

As for the IFERROR function, do not apply it before you have ascertained that your formula works correctly
In this case if you want to hide the NA error, OK, but suppose, for some reason, it returns a VALUE error? IFERROR will hide that also leading to incorrect results
IMO the ISNA function is safer
I have tried ISNA and IFERROR, and IFERROR seems to work better for what I am using this for. This report goes to a lot of VPs in the company i work for, and the cleaner it is, the better, but I truly appreciate the feedback.
Reply With Quote
  #6  
Old 03-31-2022, 07:57 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Formula help Windows 7 64bit Formula help Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,771
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Please mark thread as " solved". thx
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #7  
Old 04-01-2022, 12:21 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Formula help Windows 7 64bit Formula help Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,771
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Thanks for the rep
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Copy Row 2 Row But Next Column In Formula From Another Tab TimG Excel 3 04-16-2018 09:20 PM
Help with an IF Formula Cbate Excel 1 08-17-2017 07:29 AM
Formula help Possible to use an existing vlookup formula to also insert correct info and trigger a SUM formula innkeeper9 Excel 2 09-13-2016 08:59 PM
Need help with dragging a formula and changing a reference column as I drag the formula. LupeB Excel 1 10-22-2015 03:02 PM
Formula help WHEN formula agent007 Excel 5 02-06-2014 09:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:07 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft