Excel: Wildcard Conditional Formatting

前提是你 提交于 2019-12-13 01:55:25

问题


I want to use a wildcard in order to format certain cells - here's what I am doing:

  1. File names get outputted into a sheet - these file names look like FileName = String1_numberstring_String2.csv
  2. The numberstring is a text, like 20131019
  3. I want to bold/flag any of these file names that is on a weekend. I already have a table on the right of the sheet that brings out the weekend number strings that I could reference in a formula
  4. This is the code I have been messing with: (I think using a wildcard would work best for the string1 / string 2 because it changes, but definitely open to suggestions - "K5" below references a cell that calls out a weekend numberstring

    =if(A:A = *& "_" & K5 & "_" &*, 1, 0)


回答1:


If the numberstring is the 8 characters immediately following the first underscore then you can extract those 8 digits with this formula

=MID(A1,FIND("_",A1)+1,8)

....so to convert to a date and check if it's a weekend you can use this formula

=WEEKDAY(TEXT(MID(A1,FIND("_",A1)+1,8),"0000-00-00"),2)>5

No weekend list required......



来源:https://stackoverflow.com/questions/20076423/excel-wildcard-conditional-formatting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!