[Solved] COUNTIFS problem

Discuss the spreadsheet application
Post Reply
Jorge_Espinoza_1973
Posts: 3
Joined: Thu Mar 31, 2022 5:47 pm

[Solved] COUNTIFS problem

Post by Jorge_Espinoza_1973 »

Hello there. I need help with the following problem regarding the countifs function.
Currently I have a set of about 2500 numbers I would like to test through a set of 1000 ranges.
I have entered the numbers to be tested in column A starting with cell A3, and the lower limit of the ranges on row 2 starting with cell B2.
Let's say the following are the first 3 ranges:
A) 0 to 12500
B) 12501 to 23195
C) 23196 to 31716, so the values entered in cells B2, C2 and D2 are 0, 12501 and 23196 respectively, and the first 3 numbers to test are:
A) 9211 (entered in cell A3),
B) 29124 (entered in cell A4); and
C) 13785 (entered in cell A5).
So far I've tried the following formulas:
A) On cell B3: =countifs(A3;>=B2;A3;<C2) which yields an Err 510; or
B) On cell B3: =countifs(A3;">=B2;A3;"<C2") which incorrectly yields 0.
So far I've getting the desired results if I manually enter the values of the lower limits of the ranges:
=countifs(A3;"<=0";A3;">12501") however this method is VERY time consuming as I would have to manually enter such limit values in 1000 different cells and useless if I get a new set of limits.
Thanks.
Last edited by Jorge_Espinoza_1973 on Thu Mar 31, 2022 10:05 pm, edited 1 time in total.
OpenOffice 4.1.7
Windows 10 Pro
Jorge_Espinoza_1973
Posts: 3
Joined: Thu Mar 31, 2022 5:47 pm

Re: COUNTIFS problem

Post by Jorge_Espinoza_1973 »

Mr XY Problem, thanks for your reply. My goal is, for all the values in column A, find to which corresponding range they belong. If I were to have a discreet amount rather than a range, I wouldn't have any problem executing this by using the countif function by attaching the cell address in the formula (i.e. if the values to compare the data to are in cells B2, C2, D2, E2, and F2 and are 0, 1, 2, 3, and 4 $respectively), and the dataset is stored from cells A3 to A2003, I could just write the following formula in cell B3: =countif($A3;B$2) and then easily copy/paste it to the remaining cells, however, so far I have not found a way to do the same using the countifs function (that is, using the cell addresses in the criteria part of the formula). I've reviewed the SUMPRODUCT function but I don't think it can help me here. Thanks
OpenOffice 4.1.7
Windows 10 Pro
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: COUNTIFS problem

Post by Villeroy »

Jorge_Espinoza_1973 wrote:for all the values in column A, find to which corresponding range they belong.
Attachments
t107470.ods
(22.05 KiB) Downloaded 105 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Jorge_Espinoza_1973
Posts: 3
Joined: Thu Mar 31, 2022 5:47 pm

Re: COUNTIFS problem

Post by Jorge_Espinoza_1973 »

Villeroy, thank you very much. I didn't know the function LOOKUP. Thank you, you have saved me a lot of time and from a big headache.
OpenOffice 4.1.7
Windows 10 Pro
Post Reply