简体   繁体   中英

MS Excel Lookup to match a range

Good morning,

I wish to automate the 'action list' on a spreadsheet.

Currently, column B contains numeric values, the type of which is described in column A. I would like Column C to do this: 1. Look for a specific word in Column A 2. Based upon the result of (1.), look at a table of values 3. Find where the value in Column B falls within the table range 4. Using the position in the range, return the action

For example, if I have 3 tables called Red, White and Blue, then typing 'Big White Light' in Colum A would point to the range of values in table 'White' only. The numeric value in column B would then finds it's position within the range available in table 'White' and return the 'Action'

在此处输入图片说明

In order for VLookup to work you have to change the "tables" ranges (columns E, G, I) to just numbers (lower limit of each range) and use a cell's custom format to show them as you want see here .

在此处输入图片说明

=IF(ISERR(FIND(LOWER($E$1);LOWER(A2)))=FALSE;VLOOKUP(ABS(B2);$E$2:$F$4;2;TRUE);IF(ISERR(FIND(LOWER($G$1);LOWER(A2)))=FALSE;VLOOKUP(ABS(B2);$G$2:$H$5;2;TRUE);IF(ISERR(FIND(LOWER($I$1);LOWER(A2)))=FALSE;VLOOKUP(ABS(B2);$I$2:$J$5;2;TRUE);"")))

You should retype the numbers into your lookup tables and use custom number formatting to show the number ranges. For example, type 21 into E3 then apply a custom number format of 0-3\\0 to make it look like 21-30 . Or type 71 into I5 and give it a custom number format of >=0 to make it look like >=71 .

If you do that then you can treat the number ranges as real numbers.

在此处输入图片说明

=VLOOKUP(ABS(B2), IF(ISNUMBER(SEARCH("white", A2)), E:F,  IF(ISNUMBER(SEARCH("blue", A2)), G:H, I:J)), 2, TRUE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM