如果查找表包含表数组中的值,我需要找到一种方法来创建一个填充字段的vlookup。
例如,A1包含帐号4563399P01 / f / 5。 A2包含帐号43823448P01S / f / 5。 我需要单元格B1显示$ 10.00,如果该帐户包含P01,B2需要显示12.50如果该帐户包含P01S。
我能够使用整个帐号使用vlookup,但是当添加新帐号时,需要将它们添加到表数组中。如果帐号包含P01,P01S,G01,S021等,则搜索帐号会更容易,因为选项有限。
我希望自从我的大脑被炸后才有意义。它似乎不应该那么难,但显然它适合我。
答案 0 :(得分:0)
我认为这可能会有所帮助。使用=IF(ISNUMBER(SEARCH("P01S",A1)), 10, IF(ISNUMBER(SEARCH("P01",A1)), 12.5, IF(ISNUMBER(SEARCH("G01",A1)), ...)))
和SEARCH
函数查找所需的字符串:
ISNUMBER
VLOOKUP
检查帐号中字符串的位置,如果位置是数字,即已找到字符串,则<style>
nav.global_nav { background-color: rgba(255,255,255,1); }
nav.global_nav.alt { background-color: transparent; }
nav.global_nav i { color: rgba(0,0,0,0.9); }
nav.global_nav i.alt { color: rgba(255,255,255,1); }
.logo svg g { fill: rgba(0,0,0,0.9); }
.logo svg g.alt { fill: rgba(0,0,0,0.9); }
#trigger-overlay span { background-color: rgba(0,0,0,0.9); }
#trigger-overlay span.alt { background-color: rgba(255,255,255,1); }
</style>
<script>
...
var elems = $('nav.global_nav, nav.global_nav i, .logo svg g, #trigger-overlay span');
$(window).scroll(function() {
scroll_start = $(this).scrollTop();
if (scroll_start > Heightofit) {
elems.addClass('alt');
} else {
elems.removeClass('alt');
}
}
...
var elems2 = $("#hamburger span, nav, nav.global_nav i");
var logoElem = $('.logo svg g');
$('#hamburger').toggle(function () {
elems2.addClass('flip');
logoElem.addClass('alt');
}, function () {
elems2.removeClass('flip');
logoElem.removeClass('alt');
});
</script>
返回true。您也可以使用相关字符串上的$days = array("1"=>"Monday", "2"=>"Tuesday", "3"=>"Wednesday", "4"=>"Thursday", "5"=>"Friday", "6"=>"Saturday", "7"=>"Sunday", );
$hours = DB::table('timetablelectures')->select('timetablelectures.id', 'timetablelectures.start_time')
->get();
$timetable = DB::table('timetable')->select('timetable.id', 'timetable.day', 'timetable.lecture_id', 'timetable.subject_id')
->get();
//SET UP SCHEDULE
$schedule = array();
foreach($timetable as $tt)
{
foreach($days as $x => $x_value)
{
if ( $tt->day==$x)
{
$schedule["{$x}"][$tt->lecture_id][] = $tt->subject_id;
}
}
}
// DISPLAY SCHEDULE, headers first
?>
<table border="1">
<tr><td align="center">Time</td>
<?php foreach ( $hours as $hour )
{
echo "<td> $hour->start_time </td>";
}
echo "</tr>";
foreach ( $days as $x => $x_value) {
echo "<tr><td>$x_value</td>";
// roll through days
foreach ( $hours as $hour ) {
echo '<td>';
// check for subjects in this slot
if ( isset($schedule[$x][$hour->id]) ) {
// and display each
foreach ( $schedule[$x][$hour->id] as $subject ) {
echo "$subject<br>";
}
}
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
替换值。这显然需要扩展您想要搜索的其余字符串。
有一点要注意的是你有P01和P01S。搜索将在包含P01S的帐户中找到P01,因此务必确保以正确的顺序放置这些 - 从P01S开始,如果找不到,则查找P01。