Started By
Message

Excel help for what I think is VLOOKUP command?

Posted on 6/9/22 at 11:47 am
Posted by yankeeundercover
Buffalo, NY
Member since Jan 2010
36366 posts
Posted on 6/9/22 at 11:47 am
Ive got a list of numbers in column A and associated values in column B... I've also got another list of numbers in column C...

I need to check the numbers in column C against the numbers in column A and if they match, place the column A's corresponding column B value in column D next to the matching column C.

I hope that makes sense...
Posted by TigerFanatic99
South Bend, Indiana
Member since Jan 2007
27427 posts
Posted on 6/9/22 at 11:54 am to
You need to nest your Vlookup in an IF statement

IF(C1=A1,VLOOKUP(A1,A:B,2,FALSE),"")

I think that should work. There may be a syntax in there you'll need to correct. I'm typing this shite out on my phone.
This post was edited on 6/9/22 at 11:55 am
Posted by mdomingue
Lafayette, LA
Member since Nov 2010
29849 posts
Posted on 6/9/22 at 12:17 pm to
Are you trying to check if the value in a cell in C appears anywhere in column A? Or the corresponding value in A on the same row for the value in C.

In other words, you have values in column A1 to A100, B1 to B100, and C1 to C100. Do you want to check if C1 is the same as A1 and if so have D1 equal to B1? Or do you want to check A1-A100and see if any match C1 then place the value for B1 into D1?



Posted by pheroy
Raleigh, NC
Member since Oct 2006
704 posts
Posted on 6/9/22 at 6:32 pm to
Shouldn't need any nested statement, you just need to set a range for the lookup, using A & B. I do this all the time.

C will be the value you're looking up, A will be the target and B will be the returned value - listed as a column number in the range. So in this example say you have data with 400 rows, i.e. A1 thru A400, and the same in B & C, you'd do:

VLOOKUP($C1,$A$1:$B$400, 2, FALSE())

Put that in D1 then copy down rows as needed.

More details/explanation...

Make sure the data in A & C is formatted the same, i.e. text or numbers otherwise you'll get a bunch of "N/A" values from the formula. ($ in this means don't change the column or row - Excel will tend to do this if you're copying things around.)

1st argument - $C1 is the value to look for
2nd argument - $A$1:$B$400 is the "range" i.e. the top left and bottom right of a rectangle defining your data.
3rd argument - 2 is the relative column number in range above, that you want to return as the "answer"
4th argument - False just means don't look for "approximate" matches only exact.
Posted by whiskey over ice
Member since Sep 2020
3243 posts
Posted on 6/9/22 at 6:42 pm to
(no message)
This post was edited on 6/9/22 at 6:44 pm
Posted by TigerFanatic99
South Bend, Indiana
Member since Jan 2007
27427 posts
Posted on 6/9/22 at 8:36 pm to
How does that cover his requirement that he only wants the B value copied into D if A=C?
Posted by pheroy
Raleigh, NC
Member since Oct 2006
704 posts
Posted on 6/9/22 at 8:52 pm to
quote:

How does that cover his requirement that he only wants the B value copied into D if A=C?



That's what the "2", the 3rd argument, does. It says "take the 2nd column in the range in 2nd arg."

This is actually a very simple, textbook version of this function. I do it all the freaking time.
This post was edited on 6/9/22 at 8:52 pm
Posted by TigerFanatic99
South Bend, Indiana
Member since Jan 2007
27427 posts
Posted on 6/9/22 at 9:01 pm to
Right, I get that. It'll work, but won't it respond with an "N/A" value if A does not equal C? The IF statement would at least draw in a blank
Posted by pheroy
Raleigh, NC
Member since Oct 2006
704 posts
Posted on 6/9/22 at 10:07 pm to
Ok - yes, that wasn't explicitly part of the request so I didn't cover that. And apologies, just realized my vlookup is the same thing anyway - didn't look closely at that part.
Posted by TigerFanatic99
South Bend, Indiana
Member since Jan 2007
27427 posts
Posted on 6/9/22 at 10:41 pm to
No worries. I'm perfectly happy being wrong if it means I learn something new
Posted by yankeeundercover
Buffalo, NY
Member since Jan 2010
36366 posts
Posted on 6/30/22 at 10:58 am to
So there’s one sheet with invoice numbers with associated fees and not every row is needed…

Basically, on one sheet, we have COLUMN A 1:100 (invoice numbers) and COLUMN B 1:100 (taxes)…associated with that list of active invoice numbers

I need to check a column of invoice numbers (call it COLUMN C) that I put in another sheet/column… and if the invoice number from COLUMN C is in COLUMN A, then the whole row needs to be highlight/flagged/ etc. or, even better, copied into a new sheet.

If anyone can share the VBA of how this is possible, I’d appreciate it.
Posted by yankeeundercover
Buffalo, NY
Member since Jan 2010
36366 posts
Posted on 7/26/22 at 4:15 pm to
Bump
Posted by Mingo Was His NameO
Brooklyn
Member since Mar 2016
25455 posts
Posted on 7/26/22 at 7:32 pm to
quote:

that wasn't explicitly part of the request


quote:

I need to check the numbers in column C against the numbers in column A and if they match
Posted by msutiger
Shreveport
Member since Jul 2008
69573 posts
Posted on 7/28/22 at 10:42 am to
(no message)
This post was edited on 4/14/23 at 2:20 pm
Posted by Mingo Was His NameO
Brooklyn
Member since Mar 2016
25455 posts
Posted on 7/28/22 at 10:57 am to
You don't need to do all that shite. Excel can handle this fine. You can run formulas pulling data across sheets.

Just v lookup the invoice numbers from "column C" to see if they appear in column A. Filter down on those values and do whatever you need to do on them. Or inbed your v lookup on an if statement to do that in one step. This is extraordinarily easy to do and a VBA isn't really needed. Should take like 3 minutes to do it manually.
Posted by msutiger
Shreveport
Member since Jul 2008
69573 posts
Posted on 7/28/22 at 11:02 am to
What I posted takes three minutes and if you read through the thread it appears he’s trying to keep it all on separate sheets.

My post is long because it broke down every step in extreme detail because I don’t know his level of excel knowledge.

As I stated before, based on the OP, the first response was all that was needed. But clearly it wasn’t what he was looking for
Posted by Mingo Was His NameO
Brooklyn
Member since Mar 2016
25455 posts
Posted on 7/28/22 at 11:05 am to
quote:

What I posted takes three minutes and if you read through the thread it appears he’s trying to keep it all on separate sheets.


But you have to use google sheets and excel can handle this fine, where the data already lives.

You're doing the same exact thing, but you are moving the data around to different places.
Posted by msutiger
Shreveport
Member since Jul 2008
69573 posts
Posted on 7/28/22 at 11:11 am to
No, I said if he is using multiple workbooks (not sheets) and for some reason has to maintain multiple workbooks it would require a little more work. Which is when I brought up google sheets.

I don’t know his data sets. Maybe he’s got active queries or connections he doesn’t want to combine into a single workbook. It was just an add on at the end since some of his posts kind of insinuated he didn’t want to combine them into a single workbook.

Eta: cleared up some of the language in my first post
This post was edited on 7/28/22 at 11:29 am
Posted by Mingo Was His NameO
Brooklyn
Member since Mar 2016
25455 posts
Posted on 7/28/22 at 2:03 pm to
quote:

I said if he is using multiple workbooks (not sheets) and for some reason has to maintain multiple workbooks it would require a little more work.


No it wouldn't
Posted by chillygentilly
70122
Member since Aug 2012
2568 posts
Posted on 7/28/22 at 2:08 pm to
Highlight columns A and C and use conditional formatting to highlight duplicate cell values. Filter column A by the highlighted cells. Copy paste into a new sheet. This shite doesn’t need to be automated.
first pageprev pagePage 1 of 2Next pagelast page

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram