Excel: Wildcard Conditional Formatting

2019-08-03 18:54发布

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条回答
Anthone
2楼-- · 2019-08-03 19:20

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......

查看更多
登录 后发表回答