number based on the value of another column.

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi

I have a column like the one below. I want to have another column beside it and each friday in column A will have number in column B as below. Is that possible to do it? Thank you very much.

[TABLE="class: grid, width: 169"]
<colgroup><col></colgroup><tbody>[TR]
[TD="align: right"]Tue, 20/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Wed, 21/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Thu, 22/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Fri, 23/08/19[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]Sat, 24/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Sun, 25/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Mon, 26/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Tue, 27/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Wed, 28/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Thu, 29/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Fri, 30/08/19[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]Sat, 31/08/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Sun, 01/09/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Mon, 02/09/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Tue, 03/09/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Wed, 04/09/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Thu, 05/09/19[/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Fri, 06/09/19[/TD]
[TD="align: right"]3[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi, there are lots of ways to do this, here's one.

Assumptions -
1) Your dates are real Excel dates, not text strings.
2) 20th August is in cell A1.

In B2 . . .
Code:
=IF(WEEKDAY(A2)=6,MAX(B$1:B1)+1,"")

and copy down as far as required.
 
Upvote 0
How about

Book1
AB
1DaesFriday
220/08/2019 
321/08/2019
422/08/2019
523/08/20191
624/08/2019
725/08/2019
826/08/2019
927/08/2019
1028/08/2019
1129/08/2019
1230/08/20192
1331/08/2019
1401/09/2019
1502/09/2019
1603/09/2019
1704/09/2019
1805/09/2019
1906/09/20193
Test
Cell Formulas
RangeFormula
B2=IF(WEEKDAY(A2)<>6,"",COUNTIF(B$1:B1,">=0")+1)
 
Upvote 0
Thank you all for the help.

Can you tell me please what does B$1:B1 mean here?
 
Upvote 0
It's a range of cells. Have a look at the formula in (say) B12.
What is it there?
 
Upvote 0
Both formulas print only 1 infront any cell which has Friday

and B12 is

=IF(WEEKDAY(A11)<>6,"",COUNTIF(B$1:B10,">=0")+1)
 
Upvote 0
Both formulas print only 1 infront any cell which has Friday

Mine doesn't, on my machine, it shows 1 for the first Friday, 2 for the 2nd Friday, 3 for the 3rd Friday, and so on.
I haven't tested Fluff's solution but it looks similar to mine and I think it will work correctly as well, if you set it up correctly.

For my solution -
Your dates need to be in column A, starting in A1.
The formula I provided needs to be in B2, and then copied down.
If any of these addresses are different in your solution, you'll need to adapt it.

What ranges are you using ?
 
Upvote 0
Both formulae work.

Book1
ABC
1DatesFluffGerald
220/08/2019  
321/08/2019
422/08/2019
523/08/201911
624/08/2019
725/08/2019
826/08/2019
927/08/2019
1028/08/2019
1129/08/2019
1230/08/201922
1331/08/2019
1401/09/2019
1502/09/2019
1603/09/2019
1704/09/2019
1805/09/2019
1906/09/201933
Test
Cell Formulas
RangeFormula
B2=IF(WEEKDAY(A2)<>6,"",COUNTIF(B$1:B1,">=0")+1)
C2=IF(WEEKDAY(A2)=6,MAX(B$1:B1)+1,"")


Judging by post#6 you entered the formula in B3 & filled down, not B2
Is your first date in A2?
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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