Is it possible to check a range for a criteria... but only up to a certain cell in the range?

jvs411

New Member
Joined
Sep 18, 2023
Messages
27
Office Version
  1. 365
Platform
  1. Windows
Have a really weird problem to solve here. I have a table here with dates (may not be in consistent chronological order) with multiple of the same weeks in a column. As you can see below
1697161910331.png


Because of this, I'm trying to find a way to auto-label each column with a unique Week label in Row 1, so it'll be like "Wk1a" and if there's a second Wk1, it'll be "Wk1b" and so on...
So the end result should be like this:
1697162055726.png

I realize in order to do this though, I'll need the formula in each cell in Row 1 to be able to detect all previous cells in the same row its in to know how to label with the letter extensions a, b, c, d, etc...
So for example, cell E2 needs be able detect B2:D2 before it in order to decide what is the letter extension for its own week. Cell F2 needs be able detect B2:E2. Cell G2 needs be able detect B2:F2. And so on.

A second bigger problem is that I have multiple tables which aren't aligned in the same single row. So the formula for each cell needs able to detect not only all previous cells in the same row its in, but also be able detect all cells in the previous row too.
For example, cell C5 needs detect not only row 2:2 up to its own cell (in this case only B5), but also the entire row A1:H1.
1697162038779-png.100273


Ultimately, the whole end result will be like this:
1697162232149.png


Anyone knows a solution? I'd be so grateful... :')
 

Attachments

  • 1697161887429.png
    1697161887429.png
    19.5 KB · Views: 2
  • 1697162038779.png
    1697162038779.png
    22.6 KB · Views: 23
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Sorry I realized there's a typo in the cell references in my post. Corrected:
So for example, cell E1 needs be able detect B1:D1 before it in order to decide what is the letter extension for its own week. Cell F1 needs be able detect B1:E1. Cell G1 needs be able detect B1:F1. And so on.
For example, cell C5 needs detect not only row 5:5 up to its own cell (in this case only B5), but also the entire row A1:H1.
 
Upvote 0
Upvote 1
Solution
Thanks so much! It worked. However I noticed a weird error here when I extended the row as a test duplicate
1697168764601.png


You can see in B17, it also says Wk13b which is a repeat from B13
 
Upvote 0
COUNTIF($B2:$H4,B6))
Thanks so much! It worked. However I noticed a weird error here when I extended the row as a test duplicate
View attachment 100285

You can see in B17, it also says Wk13b which is a repeat from B13
COUNTIF($B2:$H4,B6)) should be COUNTIF($B$2:$H4,B6)) instead, an absolute row reference was missing.
 
Upvote 0
Was there a typo in your msg? But anyway I figured it out. By absolute ref, you mean sticking the beginning cell ref at the top right?
I changed $B2 to $B$2 and now it works :)

All previous rows are highlighted.

I guess the only limitation to this is that I cannot insert any numbers in any of the rows that isn't the Week row or the COUNTIF will count extras..

1697170421950.png
 
Upvote 0
Was there a typo in your msg? But anyway I figured it out. By absolute ref, you mean sticking the beginning cell ref at the top right?
I changed $B2 to $B$2 and now it works :)

All previous rows are highlighted.

I guess the only limitation to this is that I cannot insert any numbers in any of the rows that isn't the Week row or the COUNTIF will count extras..

View attachment 100286
If your regular usage will involve inserting whole numbers in between those rows, further functions (replacing COUNTIF with SUM(IF()), and using FILTER()) can be used to only get data from rows with "Week" in column A; is that something you would need?
 
Upvote 0
If your regular usage will involve inserting whole numbers in between those rows, further functions (replacing COUNTIF with SUM(IF()), and using FILTER()) can be used to only get data from rows with "Week" in column A; is that something you would need?

If it makes the formula more accurate, sure. How would that work?
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,043
Members
449,092
Latest member
ikke

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