Look through 4 columns and return value in 5th

maykinit

New Member
Joined
Jan 19, 2009
Messages
31
I could REALLY use some help from the experts here on this one...
I would like to accomplish the following.
:confused::confused:I have four columns of data...

A B C D E
10 100 A 100RF 111A111-01
20 200 B 600FF 222A222-02
etc...

There could be potentially hundreds of rows.
Using search criteria from variables I need to look for the right combination of values found in A, B, C and D and return me the value found in E. I've been hacking away at this and could REALLY use some expert advice, preferably examples of how to make this happen. I believe I'm explaining this well enough understanding that there is often much misunderstanding coming from misinterpretation. Thanks so very much for any help you might choose to offer....
 
Prompt the user for a fifth variable, add a test for it at the end of the If statement, and increase the Offset by 1.
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Prompt the user for a fifth variable, add a test for it at the end of the If statement, and increase the Offset by 1.
I don't think I am making myself clear so here goes with a best effort attempt. This is what I am after. I will parse a text field on the spreadsheet and contain those pieces of information in variables. Lets call them s1, s2, s3, s4, s5, s6. I then need to look at the individual rows on the spreadsheet, one at a time and determine which column in each row is populated with information. For each row I need to do a direct compare against that which is contained in the variables. If there is a direct match, I need to return the value contained in column 7 from the spreadsheet. An example would be... s1 contains "10". s2 contains "100". s3 is empty, s4 is empty, s5 is empty and s6 contains "100RF". The code would find those fields that are populated on the spreadsheet, A1 contains "10", A2 contains "100", A3 is empty, A4 is empty, A5 is empty and A6 contains "100RF". Having found them it would compare them against the corresponding variables. When the row matching those variables is found the code would return the value found in column 7, whatever that value might be. I know what I need, just don't know how to make this happen. I need an expert. Please hit me with your questions if I'm not being clear. Trust me when I tell you I would so appreciate an answer to this... thanks
 
Upvote 0
<table border="0" cellpadding="0" cellspacing="0" width="500"><col style="width: 48pt;" span="6" width="64"> <col style="width: 87pt;" width="116"> <tbody><tr style="height: 12.75pt;" height="17"> <td class="xl76" style="height: 12.75pt; width: 48pt;" height="17" width="64">10</td> <td class="xl76" style="border-left: medium none; width: 48pt;" width="64">102</td> <td style="width: 48pt;" width="64">
</td> <td style="width: 48pt;" width="64">
</td> <td class="xl75" style="width: 48pt;" width="64"> </td> <td class="xl75" style="border-left: medium none; width: 48pt;" width="64"> </td> <td class="xl74" style="border-left: medium none; width: 87pt;" width="116">AB861A</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl76" style="height: 12.75pt; border-top: medium none;" height="17">10</td> <td class="xl76" style="border-top: medium none; border-left: medium none;">102</td> <td class="xl76" style="border-left: medium none;"> </td> <td class="xl76" style="border-left: medium none;"> </td> <td class="xl75" style="border-top: medium none; border-left: medium none;">04</td> <td class="xl75" style="border-top: medium none; border-left: medium none;"> </td> <td class="xl74" style="border-top: medium none; border-left: medium none;">AA861A</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl76" style="height: 12.75pt; border-top: medium none;" height="17">10</td> <td class="xl76" style="border-top: medium none; border-left: medium none;">102</td> <td class="xl76" style="border-top: medium none; border-left: medium none;"> </td> <td class="xl76" style="border-top: medium none; border-left: medium none;"> </td> <td class="xl76" style="border-top: medium none; border-left: medium none;"> </td> <td class="xl76" style="border-top: medium none; border-left: medium none;"> </td> <td class="xl74" style="border-top: medium none; border-left: medium none;">280A104-05</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl76" style="height: 12.75pt; border-top: medium none;" height="17">10</td> <td class="xl76" style="border-top: medium none; border-left: medium none;">102</td> <td class="xl76" style="border-top: medium none; border-left: medium none;">S</td> <td class="xl76" style="border-top: medium none; border-left: medium none;">S</td> <td class="xl76" style="border-top: medium none; border-left: medium none;"> </td> <td class="xl76" style="border-top: medium none; border-left: medium none;"> </td> <td class="xl74" style="border-top: medium none; border-left: medium none;">112A311-01</td> </tr> </tbody></table>
I offer the above as an example. If I had the following in variables:
s1 = "10", s2="102", s3="S", s4 = "S", s5="02, s6 is "300RF". When the code runs it would look at each of the lines above on the spreadsheet. Line one would return the value "AB861A" because S1 and S2 would match. Line two would return nothing because s5 contains "04" and not "02". Etc... hope this clarifies my objective a little.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,876
Members
452,949
Latest member
Dupuhini

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